]> git.baikalelectronics.ru Git - kernel.git/commit
block: sed-opal: pass steps via argument rather than via opal_dev
authorDavid Kozub <zub@linux.fjfi.cvut.cz>
Thu, 14 Feb 2019 00:16:06 +0000 (01:16 +0100)
committerJens Axboe <axboe@kernel.dk>
Sat, 6 Apr 2019 17:09:13 +0000 (11:09 -0600)
commitf95ec69c56886fc7e1a212f670cd1127e1167acc
tree8d19f1148c17376e1448ffc8724af05591efdc3c
parent542774274bf28a8b55956e21a3a2bff7f54c811a
block: sed-opal: pass steps via argument rather than via opal_dev

The steps argument is only read by the next function, so it can
be passed directly as an argument rather than via opal_dev.

Normally, the steps is an array on the stack, so the pointer stops
being valid then the function that set opal_dev.steps returns.
If opal_dev.steps was not set to NULL before return it would become
a dangling pointer. When the steps are passed as argument this
becomes easier to see and more difficult to misuse.

Acked-by: Jon Derrick <jonathan.derrick@intel.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Scott Bauer <sbauer@plzdonthack.me>
Signed-off-by: David Kozub <zub@linux.fjfi.cvut.cz>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/sed-opal.c