Re: [PATCH] Do not segfault because of kernel version

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/03/2011 03:02 PM, Jim Rees wrote:
> Luk Claes wrote:
> 
>   > So if the version number is not recognised - e.g. it was written in Sanskrit
>   > rather than arabic numberals, it is assumed to be a future version, not a
>   > past version.
>   > 
>   >  https://lkml.org/lkml/2011/6/14/293
>   
>   Ah, not a bad idea. In that case a parse error can be distinguished from
>   other errors. Would 'return -1' do the expected or will it give a
>   compiler warning/error we should avoid?
> 
> You can't return -1 from a function returning unsigned int.  I think you
> want to return something like
> 
> MAKE_VERSION(9999, 255, 255)

Would it not be better to return UINT_MAX in that case to avoid having
to change it when version 10000 would be released and to avoid overflows
that could potentially order lower?

Cheers

Luk
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux