public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Baisong Zhong <zhongbaisong@huawei.com>
Cc: <linux-kernel@vger.kernel.org>, <alsa-devel@alsa-project.org>,
	<perex@perex.cz>, <tiwai@suse.com>
Subject: Re: [PATCH -next v2] ALSA: pcm: fix undefined behavior in bit shift for SNDRV_PCM_RATE_KNOT
Date: Wed, 23 Nov 2022 07:57:24 +0100	[thread overview]
Message-ID: <87leo25faj.wl-tiwai@suse.de> (raw)
In-Reply-To: <20221121110044.3115686-1-zhongbaisong@huawei.com>

On Mon, 21 Nov 2022 12:00:44 +0100,
Baisong Zhong wrote:
> 
> Shifting signed 32-bit value by 31 bits is undefined, so changing
> significant bit to unsigned. The UBSAN warning calltrace like below:
> 
> UBSAN: shift-out-of-bounds in sound/core/pcm_native.c:2676:21
> left shift of 1 by 31 places cannot be represented in type 'int'
> ...
> Call Trace:
>  <TASK>
>  dump_stack_lvl+0x8d/0xcf
>  ubsan_epilogue+0xa/0x44
>  __ubsan_handle_shift_out_of_bounds+0x1e7/0x208
>  snd_pcm_open_substream+0x9f0/0xa90
>  snd_pcm_oss_open.part.26+0x313/0x670
>  snd_pcm_oss_open+0x30/0x40
>  soundcore_open+0x18b/0x2e0
>  chrdev_open+0xe2/0x270
>  do_dentry_open+0x2f7/0x620
>  path_openat+0xd66/0xe70
>  do_filp_open+0xe3/0x170
>  do_sys_openat2+0x357/0x4a0
>  do_sys_open+0x87/0xd0
>  do_syscall_64+0x34/0x80
> 
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Signed-off-by: Baisong Zhong <zhongbaisong@huawei.com>
> ---
> v2: update all SNDRV_PCM_RATE_* to 1U to keep consistent

Thanks, applied now.


Takashi

      reply	other threads:[~2022-11-23  6:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-21 11:00 [PATCH -next v2] ALSA: pcm: fix undefined behavior in bit shift for SNDRV_PCM_RATE_KNOT Baisong Zhong
2022-11-23  6:57 ` 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=87leo25faj.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --cc=zhongbaisong@huawei.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