From: Damien Le Moal <dlemoal@kernel.org>
To: Rosen Penev <rosenp@gmail.com>
Cc: linux-scsi@vger.kernel.org,
"Kai Mäkisara" <Kai.Makisara@kolumbus.fi>,
"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
"Kees Cook" <kees@kernel.org>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
"open list" <linux-kernel@vger.kernel.org>,
"open list:KERNEL HARDENING (not covered by other
areas):Keyword:b__counted_by(_le|_be|_ptr)?b"
<linux-hardening@vger.kernel.org>
Subject: Re: [PATCH] scsi: st: use kzalloc_array
Date: Sun, 5 Jul 2026 10:08:31 +0900 [thread overview]
Message-ID: <bcd2926f-66df-4ffb-b0f8-97323cee5d94@kernel.org> (raw)
In-Reply-To: <CAKxU2N8Be1XxVznSrV1KGWOyivNEFJjojd2KRXLguLYZEB=gYw@mail.gmail.com>
On 7/4/26 04:06, Rosen Penev wrote:
> On Tue, Jun 30, 2026 at 12:28 AM Damien Le Moal <dlemoal@kernel.org> wrote:
>>
>> On 6/30/26 10:21, Rosen Penev wrote:
>>> Signed-off-by: Rosen Penev <rosenp@gmail.com>
>>
>> No commit message ? Please explain your reasonning, because I find this patch
>> incorrect. See below.
>>
>>> ---
>>> drivers/scsi/st.c | 12 +++---------
>>> drivers/scsi/st.h | 3 ++-
>>> 2 files changed, 5 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
>>> index f1c3c4946637..31ae189b18e7 100644
>>> --- a/drivers/scsi/st.c
>>> +++ b/drivers/scsi/st.c
>>> @@ -149,7 +149,7 @@ static struct st_dev_parm {
>>> mode counts */
>>> static const char *st_formats[] = {
>>> "", "r", "k", "s", "l", "t", "o", "u",
>>> - "m", "v", "p", "x", "a", "y", "q", "z"};
>>> + "m", "v", "p", "x", "a", "y", "q", "z"};
>>>
>>> /* The default definitions have been moved to st_options.h */
>>>
>>> @@ -3973,21 +3973,15 @@ static struct st_buffer *new_tape_buffer(int max_sg)
>>> {
>>> struct st_buffer *tb;
>>>
>>> - tb = kzalloc_obj(struct st_buffer);
>>> + tb = kzalloc_flex(*tb, reserved_pages, max_sg);
>>> if (!tb) {
>>> printk(KERN_NOTICE "st: Can't allocate new tape buffer.\n");
>>> return NULL;
>>> }
>>> - tb->frp_segs = 0;
>>> tb->use_sg = max_sg;
>>> + tb->frp_segs = 0;
>>> tb->buffer_size = 0;
>>>
>>> - tb->reserved_pages = kzalloc_objs(struct page *, max_sg);
>>
>> reserve_pages is in the middle of struct st_buffer so you cannot use a flex array.
> This patch moves it, no?
Do! Completely missed that. Looks good then, but please write a commit message.
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2026-07-05 1:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-30 1:21 [PATCH] scsi: st: use kzalloc_array Rosen Penev
2026-06-30 7:28 ` Damien Le Moal
2026-07-03 19:06 ` Rosen Penev
2026-07-05 1:08 ` Damien Le Moal [this message]
2026-07-05 1:15 ` Rosen Penev
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=bcd2926f-66df-4ffb-b0f8-97323cee5d94@kernel.org \
--to=dlemoal@kernel.org \
--cc=James.Bottomley@hansenpartnership.com \
--cc=Kai.Makisara@kolumbus.fi \
--cc=gustavoars@kernel.org \
--cc=kees@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=rosenp@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.