From: Yang Li <yang.lee@linux.alibaba.com>
To: jejb@linux.ibm.com
Cc: martin.petersen@oracle.com, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org,
Yang Li <yang.lee@linux.alibaba.com>
Subject: [PATCH -next] scsi: initio: Fix missing memory allocation modifier
Date: Thu, 2 Dec 2021 13:58:14 +0800 [thread overview]
Message-ID: <1638424694-55470-1-git-send-email-yang.lee@linux.alibaba.com> (raw)
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@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.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
reply other threads:[~2021-12-02 5:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1638424694-55470-1-git-send-email-yang.lee@linux.alibaba.com \
--to=yang.lee@linux.alibaba.com \
--cc=jejb@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox