mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Tero Kristo <tero.kristo@linux.intel.com>,
	Hans de Goede <hdegoede@redhat.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	platform-driver-x86@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] platform/x86/intel/tpmi/plr: Uninitialized variable in plr_print_bits()
Date: Mon, 15 Jul 2024 10:44:51 -0500	[thread overview]
Message-ID: <428d4e27-6970-45d8-a7b9-7bf6af95c91a@suswa.mountain> (raw)
In-Reply-To: <1467f140-c035-cb2a-20d9-b5910971cb56@linux.intel.com>

On Mon, Jul 15, 2024 at 12:25:21PM +0300, Ilpo Järvinen wrote:
> On Fri, 12 Jul 2024, Dan Carpenter wrote:
> 
> > Initialize the "str" pointer to NULL.  There is a test later for if "str"
> > is NULL but in the original code it was either valid or uninitialized.
> > 
> > Fixes: 9e9397a41b7b ("platform/x86/intel/tpmi/plr: Add support for the plr mailbox")
> > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> > ---
> > Almost everyone automatically initializes stack variables to zero these days so
> > bugs like this don't show up in testing and we disabled GCC's uninitialized
> > variable warning so it's easy to miss.
> > 
> >  drivers/platform/x86/intel/intel_plr_tpmi.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/platform/x86/intel/intel_plr_tpmi.c b/drivers/platform/x86/intel/intel_plr_tpmi.c
> > index c1aa52c23d25..2725a1ddba92 100644
> > --- a/drivers/platform/x86/intel/intel_plr_tpmi.c
> > +++ b/drivers/platform/x86/intel/intel_plr_tpmi.c
> > @@ -162,7 +162,7 @@ static int plr_clear_cpu_status(struct tpmi_plr_die *plr_die, int cpu)
> >  static void plr_print_bits(struct seq_file *s, u64 val, int bits)
> >  {
> >  	const unsigned long mask[] = { BITMAP_FROM_U64(val) };
> > -	const char *str;
> > +	const char *str = NULL;
> >  	int bit, index;
> >  
> >  	for_each_set_bit(bit, mask, bits) {
> 
> This fix looks slightly incorrect.

s/slightly/totally/.

I'll resend.

regards,
dan carpenter


      reply	other threads:[~2024-07-15 15:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-13  1:03 Dan Carpenter
2024-07-15  9:25 ` Ilpo Järvinen
2024-07-15 15:44   ` Dan Carpenter [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=428d4e27-6970-45d8-a7b9-7bf6af95c91a@suswa.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=tero.kristo@linux.intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®