[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7cc1ada7-52eb-eb18-c56b-0b1e47cf1530@kernel.dk>
Date: Sat, 15 Jun 2019 01:46:52 -0600
From: Jens Axboe <axboe@...nel.dk>
To: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
Cc: linux-block@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] block: genhd: Use struct_size() helper
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
Powered by blists - more mailing lists