Re: [PATCH 4.19 062/125] ALSA: usb-audio: Fix possible NULL dereference at create_yamaha_midi_quirk()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux