[Crash-utility] [PATCH] Fix kernel version macros for revision numbers over 255

lijiang lijiang at redhat.com
Mon May 15 03:07:21 UTC 2023


On Mon, May 15, 2023 at 9:51 AM HAGIO KAZUHITO(萩尾 一仁) <k-hagio-ab at nec.com>
wrote:

> > Do you mean the following changes can not work?
> >
> > #define THIS_KERNEL_VERSION ((kt->kernel_version[0] << 16) + \
> >                               (kt->kernel_version[1] << 8) + \
> >                               ((kt->kernel_version[2] > 255) ? 255 :
> > (kt->kernel_version[2])))
> > #define LINUX(x,y,z) (((uint)(x) << 16) + ((uint)(y) << 8) + ((uint)(z) >
> > 255 ? 255 : (uint)(z)))
>
> No, in the current crash, this will work.  Because there is no
> if-conditional that checks a revision value over 255.
>
> >     if (THIS_KERNEL_VERSION < LINUX(4,14,300))
>
> But yes, when we need to check like this, the above cannot work.  For
> example, THIS_KERNEL_VERSION on 4.14.310 equals to LINUX(4,14,300).
>
>
Thank you for the explanation, Kazu.


> So, my thought is that it would be better to change the shift amounts
> now for future changes with the small effort, rather than change it
> again in the future.
>
>
There is a similar discussion in the kernel here, but not sure why it was
not accepted.
https://lore.kernel.org/lkml/20210206035033.2036180-3-sashal@kernel.org/

But anyway, it is just a small change, and also fine to me. So: Ack.

Thanks.
Lianbo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/crash-utility/attachments/20230515/1bf9ebd4/attachment.htm>


More information about the Crash-utility mailing list