[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3395859.dhsfOsmVIe@wuerfel>
Date: Tue, 16 Feb 2016 23:08:13 +0100
From: Arnd Bergmann <arnd@...db.de>
To: linux-arm-kernel@...ts.infradead.org
Cc: Takashi Iwai <tiwai@...e.de>, alsa-devel@...a-project.org,
linux-kernel@...r.kernel.org, Jaroslav Kysela <perex@...ex.cz>,
Mark Brown <broonie@...nel.org>, Han Lu <han.lu@...el.com>,
Libin Yang <libin.yang@...ux.intel.com>,
Thierry Reding <treding@...dia.com>,
David Henningsson <david.henningsson@...onical.com>
Subject: Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer
On Tuesday 16 February 2016 18:26:09 Arnd Bergmann wrote:
> > return err;
> > per_pin->acomp_jack = jack;
> > - jack->private_data = per_pin;
> > - jack->private_free = free_acomp_jack_priv;
> > + if (jack) {
> > + jack->private_data = per_pin;
> > + jack->private_free = free_acomp_jack_priv;
> > + }
> > return 0;
> > }
> >
> Looks good to me.
>
> Acked-by: Arnd Bergmann <arnd@...db.de>
>
Actually, on second thought, there is one notable downside
of this approach: 'jack' is guaranteed to be NULL here, so gcc
won't produce a warning if another driver makes the same mistake:
By default, we only get a warning for uses of uninitialized
variables, but not those that are known to be NULL. I think
some compiler warnings are able to warn about that too, but I
forgot the details.
Arnd
Powered by blists - more mailing lists