[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20191118143352.GA22736@duo.ucw.cz>
Date: Mon, 18 Nov 2019 15:33:52 +0100
From: Pavel Machek <pavel@...x.de>
To: Takashi Iwai <tiwai@...e.de>
Cc: Pavel Machek <pavel@...x.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Dan Carpenter <dan.carpenter@...cle.com>
Subject: Re: [PATCH 4.19 062/125] ALSA: usb-audio: Fix possible NULL
dereference at create_yamaha_midi_quirk()
Hi!
> > > Clearly code wants to allow at most one of them to be NULL.
> > >
> > > > - if (!snd_usb_validate_midi_desc(injd) ||
> > > > - !snd_usb_validate_midi_desc(outjd))
> > > > + if (!(injd && snd_usb_validate_midi_desc(injd)) ||
> > > > + !(outjd && snd_usb_validate_midi_desc(outjd)))
> > > > return -ENODEV;
> > >
> > > Yet it will return here if it is. Correct check would be
> > >
> > > + if (!(!injd || snd_usb_validate_midi_desc(injd)) ||
> > > + !(!outjd || snd_usb_validate_midi_desc(outjd)))
> > >
> > > AFAICT.
> >
> > Erm, right, but a better representation is:
> >
> > if ((injd && !snd_usb_validate_midi_desc(injd)) ||
> > (outjd && !snd_usb_validate_midi_desc(injd)))
>
> Of course, another typo:
>
> if ((injd && !snd_usb_validate_midi_desc(injd)) ||
> (outjd && !snd_usb_validate_midi_desc(outjd)))
Agreed, that is better. I was focusing on boolean algebra too much.
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)
Powered by blists - more mailing lists