]> git.hungrycats.org Git - linux/commit
scsi: arcmsr: Simplify user_len checking
authorBorislav Petkov <bp@alien8.de>
Fri, 23 Sep 2016 11:22:26 +0000 (13:22 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 Oct 2016 10:06:48 +0000 (12:06 +0200)
commit1e7f077827be9611b6382a1be5b4d208928a9fcf
tree8045bb5aaf22caf2c4bdba1cf6ec05dfdb8b64f1
parent6e3655655623c52a8a55cec01be8cf6681ee54a3
scsi: arcmsr: Simplify user_len checking

commit 4bd173c30792791a6daca8c64793ec0a4ae8324f upstream.

Do the user_len check first and then the ver_addr allocation so that we
can save us the kfree() on the error path when user_len is >
ARCMSR_API_DATA_BUFLEN.

Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Marco Grassi <marco.gra@gmail.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Tomas Henzl <thenzl@redhat.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/arcmsr/arcmsr_hba.c