diff options
author | Jesper Juhl <jj@chaosbits.net> | 2012-01-28 00:23:41 +0100 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-02-19 08:09:01 -0600 |
commit | 64b8aa75bc101eb73e2c76a66fb5432b4c83ffb2 (patch) | |
tree | 185dcaa9eca3df2d5ab3dce10e42527a28ca4db5 /drivers/scsi/bfa | |
parent | e5cc6aa4b6ef34c3f054af8c61a4f73c157589c3 (diff) | |
download | op-kernel-dev-64b8aa75bc101eb73e2c76a66fb5432b4c83ffb2.zip op-kernel-dev-64b8aa75bc101eb73e2c76a66fb5432b4c83ffb2.tar.gz |
[SCSI] bfa: don't leak mem in bfad_im_bsg_els_ct_request()
If 'drv_fcxp = kzalloc(sizeof(struct bfad_fcxp), GFP_KERNEL);' fails
and returns NULL, then we'll leak the memory allocated to 'bsg_fcpt'
when we jump to 'out:' and the variable subsequently goes out of
scope.
Also remove the cast of the kzalloc() return value. kzalloc() returns
a void* which is implicitly converted, so the explicit cast is
pointless.
Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Acked-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/bfa')
-rw-r--r-- | drivers/scsi/bfa/bfad_bsg.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c index 530de2b..8005c6c 100644 --- a/drivers/scsi/bfa/bfad_bsg.c +++ b/drivers/scsi/bfa/bfad_bsg.c @@ -3047,8 +3047,7 @@ bfad_im_bsg_els_ct_request(struct fc_bsg_job *job) * Allocate buffer for bsg_fcpt and do a copy_from_user op for payload * buffer of size bsg_data->payload_len */ - bsg_fcpt = (struct bfa_bsg_fcpt_s *) - kzalloc(bsg_data->payload_len, GFP_KERNEL); + bsg_fcpt = kzalloc(bsg_data->payload_len, GFP_KERNEL); if (!bsg_fcpt) goto out; @@ -3060,6 +3059,7 @@ bfad_im_bsg_els_ct_request(struct fc_bsg_job *job) drv_fcxp = kzalloc(sizeof(struct bfad_fcxp), GFP_KERNEL); if (drv_fcxp == NULL) { + kfree(bsg_fcpt); rc = -ENOMEM; goto out; } |