The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: David Laight <David.Laight@ACULAB.COM>,
	Ben Skeggs <bskeggs@redhat.com>, David Airlie <airlied@linux.ie>
Cc: "dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"nouveau@lists.freedesktop.org" <nouveau@lists.freedesktop.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drm/nouveau/secboot: remove VLA usage
Date: Tue, 13 Mar 2018 11:18:05 -0500	[thread overview]
Message-ID: <ba264656-6e56-e907-97c0-8cdd28ce8340@embeddedor.com> (raw)
In-Reply-To: <6977788dfbac4b70b54fd56310cc27fe@AcuMS.aculab.com>

Hi David,

On 03/13/2018 11:10 AM, David Laight wrote:
> From: Gustavo A. R. Silva
>> Sent: 13 March 2018 14:48
>> In preparation to enabling -Wvla, remove VLA. In this particular
>> case directly use macro NVKM_MSGQUEUE_CMDLINE_SIZE instead of local
>> variable cmdline_size. Also, remove cmdline_size as it is not
>> actually useful anymore.
> ...
>> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/ls_ucode_msgqueue.c
>> b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/ls_ucode_msgqueue.c
>> index 6f10b09..2da147b 100644
>> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/ls_ucode_msgqueue.c
>> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/ls_ucode_msgqueue.c
>> @@ -80,12 +80,12 @@ acr_ls_msgqueue_post_run(struct nvkm_msgqueue *queue,
>>   			 struct nvkm_falcon *falcon, u32 addr_args)
>>   {
>>   	struct nvkm_device *device = falcon->owner->device;
>> -	u32 cmdline_size = NVKM_MSGQUEUE_CMDLINE_SIZE;
>> -	u8 buf[cmdline_size];
>> +	u8 buf[NVKM_MSGQUEUE_CMDLINE_SIZE];
>>
>> -	memset(buf, 0, cmdline_size);
>> +	memset(buf, 0, NVKM_MSGQUEUE_CMDLINE_SIZE);
>>   	nvkm_msgqueue_write_cmdline(queue, buf);
>> -	nvkm_falcon_load_dmem(falcon, buf, addr_args, cmdline_size, 0);
>> +	nvkm_falcon_load_dmem(falcon, buf, addr_args,
>> +			      NVKM_MSGQUEUE_CMDLINE_SIZE, 0);
> 
> I think I'd use 'sizeof (buf)' in both those lines.
> 

Yeah. I like it.

I'll send v2 with that change shortly.

Thanks
--
Gustavo

      reply	other threads:[~2018-03-13 16:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-13 14:48 [PATCH] drm/nouveau/secboot: remove VLA usage Gustavo A. R. Silva
2018-03-13 16:10 ` David Laight
2018-03-13 16:18   ` Gustavo A. R. Silva [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=ba264656-6e56-e907-97c0-8cdd28ce8340@embeddedor.com \
    --to=gustavo@embeddedor.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=airlied@linux.ie \
    --cc=bskeggs@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nouveau@lists.freedesktop.org \
    /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