OSDN Git Service

scsi: sg: sg_read(): simplify reading ->pack_id of userland sg_io_hdr_t
authorAl Viro <viro@zeniv.linux.org.uk>
Thu, 17 Oct 2019 19:39:21 +0000 (20:39 +0100)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 6 Nov 2019 05:04:03 +0000 (00:04 -0500)
commitc35a5cfb41509c2214228aa321509ffd91cbf063
treed048d4a53a89eb168c390cf9e1d79b12ddd9312d
parent062c9d4527ccbdbf49139607efd44c9c3f82a2fd
scsi: sg: sg_read(): simplify reading ->pack_id of userland sg_io_hdr_t

We don't need to allocate a temporary buffer and read the entire structure
in it, only to fetch a single field and free what we'd allocated.  Just use
get_user() and be done with it...

Link: https://lore.kernel.org/r/20191017193925.25539-4-viro@ZenIV.linux.org.uk
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/sg.c