lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Thu,  2 Dec 2021 13:58:14 +0800
From:   Yang Li <yang.lee@...ux.alibaba.com>
To:     jejb@...ux.ibm.com
Cc:     martin.petersen@...cle.com, linux-scsi@...r.kernel.org,
        linux-kernel@...r.kernel.org, Yang Li <yang.lee@...ux.alibaba.com>
Subject: [PATCH -next] scsi: initio: Fix missing memory allocation modifier

The function initio_probe_one() allocates a DMA buffer without the
GFP_KERNEL modifier, fix this by using (GFP_KERNEL | GFP_DMA) instead of
only GFP_DMA as the probe happens in non-interrupt context.

At the same time, change the if statement to the more typical kernel
style.

Eliminate the follow smatch warning:
drivers/scsi/initio.c:2850 initio_probe_one() error: no modifiers for
allocation.

Reported-by: Abaci Robot <abaci@...ux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@...ux.alibaba.com>
---
 drivers/scsi/initio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c
index 9cdee38..5982274 100644
--- a/drivers/scsi/initio.c
+++ b/drivers/scsi/initio.c
@@ -2847,7 +2847,8 @@ static int initio_probe_one(struct pci_dev *pdev,
 
 	for (; num_scb >= MAX_TARGETS + 3; num_scb--) {
 		i = num_scb * sizeof(struct scsi_ctrl_blk);
-		if ((scb = kzalloc(i, GFP_DMA)) != NULL)
+		scb = kzalloc(i, (GFP_KERNEL | GFP_DMA));
+		if (scb)
 			break;
 	}
 
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ