From: Takashi Iwai <tiwai@suse.de>
To: Cezary Rojewski <cezary.rojewski@intel.com>
Cc: Takashi Iwai <tiwai@suse.de>, <linux-kernel@vger.kernel.org>,
<linux-sound@vger.kernel.org>
Subject: Re: [PATCH v3 7/7] ALSA: seq: Don't lose partial read failure
Date: Thu, 08 Oct 2026 13:59:53 +0200 [thread overview]
Message-ID: <87cxtk5rnq.wl-tiwai@suse.de> (raw)
In-Reply-To: <d17960fd-154a-4975-aba5-e67c8bc53854@intel.com>
On Thu, 08 Oct 2026 13:43:47 +0200,
Cezary Rojewski wrote:
>
> On 10/8/2026 10:53 AM, Takashi Iwai wrote:
> > On Thu, 08 Oct 2026 10:32:29 +0200,
> > Cezary Rojewski wrote:
>
> >>> --- a/sound/core/seq/seq_clientmgr.c
> >>> +++ b/sound/core/seq/seq_clientmgr.c
> >>> @@ -480,11 +480,11 @@ static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count,
> >>> if (err < 0) {
> >>> if (cell)
> >>> snd_seq_fifo_cell_putback(fifo, cell);
> >>> - if (err == -EAGAIN && result > 0)
> >>> - err = 0;
> >>> }
> >>>
> >>> - return (err < 0) ? err : result;
> >>> + if (result > 0)
> >>> + return result;
> >>> + return err < 0 ? err : 0;
> >>
> >> Can 'err' even be positive? Looks to me as if 'result' holds the bytes
> >> and flat 'return err' suffices.
> >
> > Yes, it's just to make sure.
> It's not a blocker obviously, I'm just in favor of avoiding
> double-protection. I'd rather fix the problem that causes 'err' to be
> positive if somehow things turn that way.
Well, at this place, I'd rather to be sure than sorry.
It's the end return point to user-space, hence we need to have a
stricter check.
Of course, if it were involving too heavy performance, I'd agree for
optimization, but it's not that case :)
thanks,
Takashi
prev parent reply other threads:[~2026-10-08 12:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-07 17:25 [PATCH v3 0/7] ALSA: Fix yet more bugs reported by Sashiko Takashi Iwai
2026-10-07 17:25 ` [PATCH v3 1/7] ALSA: seq: Fix missing direction and ump_group handling in 32bit compat ioctl Takashi Iwai
2026-10-07 17:25 ` [PATCH v3 2/7] ALSA: pcmtest: Fix leak at probe error Takashi Iwai
2026-10-07 17:25 ` [PATCH v3 3/7] ALSA: pcmtest: Use platform_device_register_simple() Takashi Iwai
2026-10-07 17:25 ` [PATCH v3 4/7] ALSA: info: Fix memory leak at card removal Takashi Iwai
2026-10-07 17:25 ` [PATCH v3 5/7] ALSA: aloop: Avoid a bad mixure of guard() and goto Takashi Iwai
2026-10-07 17:25 ` [PATCH v3 6/7] ALSA: core: Fix leaks at snd_card_init() error paths Takashi Iwai
2026-10-07 17:25 ` [PATCH v3 7/7] ALSA: seq: Don't lose partial read failure Takashi Iwai
2026-10-08 8:32 ` Cezary Rojewski
2026-10-08 8:53 ` Takashi Iwai
2026-10-08 11:43 ` Cezary Rojewski
2026-10-08 11:59 ` 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=87cxtk5rnq.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=cezary.rojewski@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.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 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.