lkml.org 
[lkml]   [2019]   [Jun]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] block: genhd: Use struct_size() helper
From
Date
On 5/31/19 12:47 PM, Gustavo A. R. Silva wrote:
> Make use of the struct_size() helper instead of an open-coded version
> in order to avoid any potential type mistakes, in particular in the
> context in which this code is being used.
>
> So, replace the following form:
>
> sizeof(*new_ptbl) + target * sizeof(new_ptbl->part[0])
>
> with:
>
> struct_size(new_ptbl, part, target)
>
> Also, notice that variable size is unnecessary, hence it is removed.
>
> This code was detected with the help of Coccinelle.

Applied, thanks.

--
Jens Axboe

\
 
 \ /
  Last update: 2019-06-15 09:47    [W:0.041 / U:0.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site