mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Kees Cook <keescook@chromium.org>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org,
	linux-hardening@vger.kernel.org
Subject: Re: [PATCH] ALSA: mixart: Reduce size of mixart_timer_notify
Date: Tue, 07 Dec 2021 09:00:54 +0100	[thread overview]
Message-ID: <s5hzgpcond5.wl-tiwai@suse.de> (raw)
In-Reply-To: <20211207062941.2413679-1-keescook@chromium.org>

On Tue, 07 Dec 2021 07:29:41 +0100,
Kees Cook wrote:
> 
> The mixart_timer_notify structure was larger than could be represented
> by the mixart_msg_data array storage. Adjust the size to as large as
> possible to fix the warning seen with -Warray-bounds builds:
> 
> sound/pci/mixart/mixart_core.c: In function 'snd_mixart_threaded_irq':
> sound/pci/mixart/mixart_core.c:447:50: error: array subscript 'struct mixart_timer_notify[0]' is partly outside array bounds of 'u32[128]' {aka 'unsigned int[128]'} [-Werror=array-bounds]
>   447 |                                 for(i=0; i<notify->stream_count; i++) {
>       |                                                  ^~
> sound/pci/mixart/mixart_core.c:328:12: note: while referencing 'mixart_msg_data'
>   328 | static u32 mixart_msg_data[MSG_DEFAULT_SIZE / 4];
>       |            ^~~~~~~~~~~~~~~
> 
> Signed-off-by: Kees Cook <keescook@chromium.org>

Thanks, applied now.

> @@ -444,6 +442,7 @@ irqreturn_t snd_mixart_threaded_irq(int irq, void *dev_id)
>  				struct mixart_timer_notify *notify;
>  				notify = (struct mixart_timer_notify *)mixart_msg_data;
>  
> +				BUILD_BUG_ON(sizeof(notify) > sizeof(mixart_msg_data));
>  				for(i=0; i<notify->stream_count; i++) {
>  
>  					u32 buffer_id = notify->streams[i].buffer_id;

I guess we should add the array boundary check of
notify->stream_count, instead of fully relying on the hardware reply,
too.  Will submit the additional check.


Takashi

      reply	other threads:[~2021-12-07  8:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-07  6:29 Kees Cook
2021-12-07  8:00 ` Takashi Iwai [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=s5hzgpcond5.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=keescook@chromium.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.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

all inboxes | Powered by JetHome®