Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org, Jaroslav Kysela <perex@perex.cz>
Subject: Re: [PATCH 07/14] ALSA: emu10k1: properly assert DSP init constraints
Date: Fri, 12 May 2023 11:25:23 +0200	[thread overview]
Message-ID: <ZF4GAwocaGBJRidc@ugly> (raw)
In-Reply-To: <87a5yaaum2.wl-tiwai@suse.de>

On Fri, May 12, 2023 at 09:15:17AM +0200, Takashi Iwai wrote:
>On Wed, 10 May 2023 19:39:10 +0200,
>Oswald Buddenhagen wrote:
>> 
>> If these are hit, we've already trashed kernel memory by writing past
>> the end of the allocated buffer. There is no recovery from that.
>> 
>Again, this is NAK.

>First of all, if we really do care the overflow
>seriously, we should check at each increment instead of after
>breakage.  It shouldn't be too difficult at all.
>
not difficult, but pointless bloat.

>Second, using BUG_ON() like this case is an overkill.  It was clearly
>stated by Linus in the past a few times (although I can't find the
>source right now).
>
you seem to have an irrational aversion against assertions, maybe 
because linus likes to scream at people.

relevant comments from linus were easy enough to find:
https://yarchive.net/comp/linux/BUG.html
https://lore.kernel.org/all/CA+55aFwyNTLuZgOWMTRuabWobF27ygskuxvFd-P0n-3UNT=0Og@mail.gmail.com/T/#u

and there is also the documentation on BUG() itself.

i don't see anything in either of these that would imply that my use of 
BUG_ON() is inappropriate. it catches a serious programming error, is 
easy to prove correct (the scope is a single function), and the only 
immediate effect is that it will crash the insmod process (though i 
would expect possible followup effects due to the kernel memory 
corruption, which is exactly why the assert is there). i have a hard 
time thinking of a *more* appropriate use for BUG().

regards

  reply	other threads:[~2023-05-12  9:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-10 17:39 [PATCH 00/14] ALSA: emu10k1: various improvements to the DSP-based mixer code Oswald Buddenhagen
2023-05-10 17:39 ` [PATCH 01/14] ALSA: emu10k1: make tone control switch mono Oswald Buddenhagen
2023-05-10 17:39 ` [PATCH 02/14] ALSA: emu10k1: roll up loops in DSP setup code for Audigy Oswald Buddenhagen
2023-05-10 17:39 ` [PATCH 03/14] ALSA: emu10k1: fix+optimize E-MU stereo capture DSP code Oswald Buddenhagen
2023-05-10 17:39 ` [PATCH 04/14] ALSA: emu10k1: simplify snd_emu10k1_audigy_dsp_convert_32_to_2x16() Oswald Buddenhagen
2023-05-10 17:39 ` [PATCH 05/14] ALSA: emu10k1: apply channel delay hack to all E-MU cards Oswald Buddenhagen
2023-05-10 17:39 ` [PATCH 06/14] ALSA: emu10k1: simplify tone control switch DSP code Oswald Buddenhagen
2023-05-10 17:39 ` [PATCH 07/14] ALSA: emu10k1: properly assert DSP init constraints Oswald Buddenhagen
2023-05-12  7:15   ` Takashi Iwai
2023-05-12  9:25     ` Oswald Buddenhagen [this message]
2023-05-12  9:59       ` Takashi Iwai
2023-05-10 17:39 ` [PATCH 08/14] ALSA: emu10k1: polish audigy GPR allocation Oswald Buddenhagen
2023-05-10 17:39 ` [PATCH 09/14] ALSA: emu10k1: fix non-zero mixer control defaults in highres mode Oswald Buddenhagen
2023-05-10 17:39 ` [PATCH 10/14] ALSA: emu10k1: validate min/max values of translated controls Oswald Buddenhagen
2023-05-10 17:39 ` [PATCH 11/14] ALSA: emu10k1: omit non-applicable mixer controls for E-MU cards Oswald Buddenhagen
2023-05-10 17:39 ` [PATCH 12/14] ALSA: emu10k1: skip mic capture PCM for cards without AC97 codec Oswald Buddenhagen
2023-05-10 17:39 ` [PATCH 13/14] ALSA: emu10k1: enable bit-exact playback, part 1: DSP attenuation Oswald Buddenhagen
2023-05-10 17:39 ` [PATCH 14/14] ALSA: emu10k1: enable bit-exact playback, part 2: voice attenuation Oswald Buddenhagen
2023-05-12  7:21 ` [PATCH 00/14] ALSA: emu10k1: various improvements to the DSP-based mixer code Takashi Iwai

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=ZF4GAwocaGBJRidc@ugly \
    --to=oswald.buddenhagen@gmx.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=perex@perex.cz \
    --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