From: Takashi Iwai <tiwai@suse.de>
To: Oswald Buddenhagen <oswald.buddenhagen@gmx.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:59:48 +0200 [thread overview]
Message-ID: <87o7mpamzv.wl-tiwai@suse.de> (raw)
In-Reply-To: <ZF4GAwocaGBJRidc@ugly>
On Fri, 12 May 2023 11:25:23 +0200,
Oswald Buddenhagen wrote:
>
> 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.
Not because he's screaming but, it's because his opinion is correct
regarding this.
> 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().
I can't agree here at all. Sorry, but this is still NAK.
The reason why BUG_ON() is bad is that it cannot allow debugging
easily. It crashes and locks up, and you may not see what's going
on.
Do you want to catch and fix the bug? Then put the check at more
proper pint that prevents the real corruption. the check is
basically already too late -- it means that you might have already
broken someone else's system. If the size matters, it can be a
conditional build with CONFIG_SND_DEBUG, for example.
But simply replacing and putting BUG_ON() makes little sense.
Of course, it's just my opinion, but I won't change my mind about it.
So I'm not going to discuss about this further and waste time.
thanks,
Takashi
next prev parent reply other threads:[~2023-05-12 10:00 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
2023-05-12 9:59 ` Takashi Iwai [this message]
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=87o7mpamzv.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=oswald.buddenhagen@gmx.de \
--cc=perex@perex.cz \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.