scsi: aacraid: report -ENOMEM to upper layer from aac_convert_sgraw2()
aac_convert_sgraw2() kmalloc memory and return -1 on error, which should be -ENOMEM. However, nobody is checking return value, so with this change, -ENOMEM is propagated to upper layer. Signed-off-by: Nikola Pajkovsky <npajkovsky@suse.cz> Reviewed-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
a226032398
commit
9667624698
@ -3950,8 +3950,12 @@ static long aac_build_sgraw2(struct scsi_cmnd *scsicmd,
|
|||||||
if (!err_found)
|
if (!err_found)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i > 0 && nseg_new <= sg_max)
|
if (i > 0 && nseg_new <= sg_max) {
|
||||||
aac_convert_sgraw2(rio2, i, nseg, nseg_new);
|
int ret = aac_convert_sgraw2(rio2, i, nseg, nseg_new);
|
||||||
|
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
rio2->flags |= cpu_to_le16(RIO2_SGL_CONFORMANT);
|
rio2->flags |= cpu_to_le16(RIO2_SGL_CONFORMANT);
|
||||||
|
|
||||||
@ -3975,7 +3979,7 @@ static int aac_convert_sgraw2(struct aac_raw_io2 *rio2, int pages, int nseg, int
|
|||||||
|
|
||||||
sge = kmalloc(nseg_new * sizeof(struct sge_ieee1212), GFP_ATOMIC);
|
sge = kmalloc(nseg_new * sizeof(struct sge_ieee1212), GFP_ATOMIC);
|
||||||
if (sge == NULL)
|
if (sge == NULL)
|
||||||
return -1;
|
return -ENOMEM;
|
||||||
|
|
||||||
for (i = 1, pos = 1; i < nseg-1; ++i) {
|
for (i = 1, pos = 1; i < nseg-1; ++i) {
|
||||||
for (j = 0; j < rio2->sge[i].length / (pages * PAGE_SIZE); ++j) {
|
for (j = 0; j < rio2->sge[i].length / (pages * PAGE_SIZE); ++j) {
|
||||||
|
Loading…
Reference in New Issue
Block a user