Re: [PATCH v2] netlink: Return unsigned value for nla_len()

2023-12-04 Thread Nicolas Dichtel
Le 04/12/2023 à 23:21, Kees Cook a écrit : [snip] >>> diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h >>> index f87aaf28a649..270feed9fd63 100644 >>> --- a/include/uapi/linux/netlink.h >>> +++ b/include/uapi/linux/netlink.h >>> @@ -247,7 +247,7 @@ struct nlattr { >>> >>>

Re: [PATCH v2] netlink: Return unsigned value for nla_len()

2023-12-04 Thread Kees Cook
On Mon, Dec 04, 2023 at 10:22:25AM +0100, Nicolas Dichtel wrote: > Le 02/12/2023 à 21:25, Kees Cook a écrit : > > The return value from nla_len() is never expected to be negative, and can > > never be more than struct nlattr::nla_len (a u16). Adjust the prototype > > on the function. This will let

Re: [PATCH v2] netlink: Return unsigned value for nla_len()

2023-12-04 Thread Nicolas Dichtel
Le 02/12/2023 à 21:25, Kees Cook a écrit : > The return value from nla_len() is never expected to be negative, and can > never be more than struct nlattr::nla_len (a u16). Adjust the prototype > on the function. This will let GCC's value range optimization passes > know that the return can never

[PATCH v2] netlink: Return unsigned value for nla_len()

2023-12-02 Thread Kees Cook
The return value from nla_len() is never expected to be negative, and can never be more than struct nlattr::nla_len (a u16). Adjust the prototype on the function. This will let GCC's value range optimization passes know that the return can never be negative, and can never be larger than u16. As