mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Cássio Gabriel Monteiro Pires" <cassiogabrielcontato@gmail.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: Takashi Iwai <tiwai@suse.com>, Jaroslav Kysela <perex@perex.cz>,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	notify@kernel.org
Subject: Re: [PATCH] ALSA: seq: Use flexible array for device arguments
Date: Sun, 31 May 2026 20:25:35 -0300	[thread overview]
Message-ID: <d90f4c6f-8b09-41a3-9d80-bfa0b0a411c2@gmail.com> (raw)
In-Reply-To: <871perpujb.wl-tiwai@suse.de>


[-- Attachment #1.1: Type: text/plain, Size: 876 bytes --]

On 5/31/26 10:39, Takashi Iwai wrote:
>> diff --git a/sound/core/seq_device.c b/sound/core/seq_device.c
>> index 1b062d6b17ea..a7b69ff07261 100644
>> --- a/sound/core/seq_device.c
>> +++ b/sound/core/seq_device.c
>> @@ -234,7 +234,10 @@ int snd_seq_device_new(struct snd_card *card, int device, const char *id,
>>  	if (snd_BUG_ON(!id))
>>  		return -EINVAL;
>>  
>> -	dev = kzalloc(sizeof(*dev) + argsize, GFP_KERNEL);
>> +	if (argsize < 0)
>> +		return -EINVAL;
>> +
>> +	dev = kzalloc(struct_size(dev, args, argsize), GFP_KERNEL);
>>  	if (!dev)
>>  		return -ENOMEM;
> 
> IIRC, we can use kzalloc_flex() for this kind, too:
> 
> 	dev = kzalloc_flex(*dev, args, argsize);

Thanks, I missed kzalloc_flex(). I’ll keep the negative
argsize check in v2, so invalid callers get -EINVAL before
the count is converted to size_t.

-- 
Thanks,
Cássio

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

      reply	other threads:[~2026-05-31 23:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-29 13:12 Cássio Gabriel
2026-05-31 13:39 ` Takashi Iwai
2026-05-31 23:25   ` Cássio Gabriel Monteiro Pires [this message]

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=d90f4c6f-8b09-41a3-9d80-bfa0b0a411c2@gmail.com \
    --to=cassiogabrielcontato@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=notify@kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --cc=tiwai@suse.de \
    /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

all inboxes | Powered by JetHome®