Re: [PATCH 1/2] VMCI: Remove handle_arr_calc_size()

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

 



On Fri, Dec 08, 2023 at 10:14:35PM +0100, Christophe JAILLET wrote:
> Le 08/12/2023 à 21:59, Kees Cook a écrit :
> > On Fri, Dec 08, 2023 at 09:46:09PM +0100, Christophe JAILLET wrote:
> > > Use struct_size() instead of handle_arr_calc_size().
> > > This is much more conventionnal.
> > > 
> > > Suggested-by: Kees Cook <keescook@xxxxxxxxxxxx>
> > > Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
> > 
> > Looks good. And since capacity in u32, there's no need for size_add().
> 
> Hmm,
> 
> isn't u32 + u32 --> u32, so can overflow?
> If I understand correctly, the type promotion to size_t will occur after the
> addition.

Oh lovely, I thought the promotion was first. Ugh.

> So size_add() looks needed, or I missed something?

Yeah, and I'm also to stuck in pretending 32-bit systems don't exist.
So, yes, please include size_add()...

-Kees

> 
> CJ
> 
> > 
> > Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>
> > 
> 

-- 
Kees Cook




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux