mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Lopez, Jorge A (Security)" <jorge.lopez2@hp.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	Dan Carpenter <dan.carpenter@linaro.org>
Cc: "Hans de Goede" <hdegoede@redhat.com>,
	"Mark Gross" <markgross@kernel.org>,
	"Thomas Weißschuh" <linux@weissschuh.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>,
	"platform-driver-x86@vger.kernel.org"
	<platform-driver-x86@vger.kernel.org>
Subject: RE: [PATCH] platform/x86: hp-bioscfg: Fix some memory leaks in hp_populate_enumeration_elements_from_package()
Date: Tue, 25 Jul 2023 20:00:20 +0000	[thread overview]
Message-ID: <PH0PR84MB19533DF0CE1E2F5951031150A803A@PH0PR84MB1953.NAMPRD84.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <8d98b544-6191-53ce-fcb7-07d932c40f82@wanadoo.fr>

Hi Christophe,

I will submit individual patches to address memory leaks and uninitialized variable errors for each source file listed below.

> hp_populate_string_elements_from_package
drivers/platform/x86/hp/hp-bioscfg/string-attributes.c

> hp_populate_ordered_list_elements_from_package()
drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c

> hp_populate_integer_elements_from_package()
drivers/platform/x86/hp/hp-bioscfg/int-attributes.c

> hp_populate_enumeration_elements_from_package()
drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c

> hp_populate_password_elements_from_package()
drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c


Regards,

Jorge Lopez
HP Inc

“Once you stop learning, you start dying”
Albert Einstein

> -----Original Message-----
> From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Sent: Tuesday, July 18, 2023 12:37 PM
> To: Dan Carpenter <dan.carpenter@linaro.org>
> Cc: Lopez, Jorge A (Security) <jorge.lopez2@hp.com>; Hans de Goede
> <hdegoede@redhat.com>; Mark Gross <markgross@kernel.org>; Thomas
> Weißschuh <linux@weissschuh.net>; linux-kernel@vger.kernel.org; kernel-
> janitors@vger.kernel.org; platform-driver-x86@vger.kernel.org
> Subject: Re: [PATCH] platform/x86: hp-bioscfg: Fix some memory leaks in
> hp_populate_enumeration_elements_from_package()
> 
> CAUTION: External Email
> 
> Le 18/07/2023 à 09:55, Dan Carpenter a écrit :
> > On Mon, Jul 17, 2023 at 10:53:37PM +0200, Christophe JAILLET wrote:
> >> In the loop in the ENUM_POSSIBLE_VALUES case, we allocate some
> memory
> >> that is never freed.
> >>
> >> While at it, add some "str_value = NULL" to avoid some potential
> >> double free.
> >>
> >> Fixes: 6b2770bfd6f9 ("platform/x86: hp-bioscfg: enum-attributes")
> >> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> >> ---
> >> /!\ Speculative /!\
> >>
> >>     This patch is based on analysis of the surrounding code and should be
> >>     reviewed with care !
> >>
> >> /!\ Speculative /!\
> >
> > I reported these bugs yesterday.
> 
> Ok, seen now...
> ... but I don't read platform-driver-x86@vger.kernel.org :)
> 
> CJ
> 
> > I don't think this is the correct fix.
> > I thought about making the str_value local to the for loop.  That's
> > sort of like what your patch does.  But I wasn't sure that was
> > necessarily correct either.
> >
> > This code needs more testing as well.  It seems no one has called this
> > function.
> >
> > Smatch complained about uninitialized variables as well.  I didn't
> > bother to report that yesterday but I may as well.
> >
> > regards,
> > dan carpenter
> >
> > drivers/platform/x86/hp/hp-bioscfg/string-attributes.c:188
> hp_populate_string_elements_from_package() error: uninitialized symbol
> 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/string-attributes.c:191
> hp_populate_string_elements_from_package() error: uninitialized symbol
> 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/string-attributes.c:194
> hp_populate_string_elements_from_package() error: uninitialized symbol
> 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/string-attributes.c:197
> hp_populate_string_elements_from_package() error: uninitialized symbol
> 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/string-attributes.c:200
> hp_populate_string_elements_from_package() error: uninitialized symbol
> 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/string-attributes.c:239
> hp_populate_string_elements_from_package() error: uninitialized symbol
> 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/string-attributes.c:242
> hp_populate_string_elements_from_package() error: uninitialized symbol
> 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/string-attributes.c:245
> hp_populate_string_elements_from_package() error: uninitialized symbol
> 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c:192
> hp_populate_ordered_list_elements_from_package() error: uninitialized
> symbol 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c:195
> hp_populate_ordered_list_elements_from_package() error: uninitialized
> symbol 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c:198
> hp_populate_ordered_list_elements_from_package() error: uninitialized
> symbol 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c:201
> hp_populate_ordered_list_elements_from_package() error: uninitialized
> symbol 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c:204
> hp_populate_ordered_list_elements_from_package() error: uninitialized
> symbol 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c:238
> hp_populate_ordered_list_elements_from_package() error: uninitialized
> symbol 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c:242
> hp_populate_ordered_list_elements_from_package() error: uninitialized
> symbol 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c:262
> hp_populate_ordered_list_elements_from_package() error: uninitialized
> symbol 'value_len'.
> > drivers/platform/x86/hp/hp-bioscfg/int-attributes.c:198
> hp_populate_integer_elements_from_package() error: uninitialized symbol
> 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/int-attributes.c:201
> hp_populate_integer_elements_from_package() error: uninitialized symbol
> 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/int-attributes.c:204
> hp_populate_integer_elements_from_package() error: uninitialized symbol
> 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/int-attributes.c:207
> hp_populate_integer_elements_from_package() error: uninitialized symbol
> 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/int-attributes.c:246
> hp_populate_integer_elements_from_package() error: uninitialized symbol
> 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/int-attributes.c:249
> hp_populate_integer_elements_from_package() error: uninitialized symbol
> 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/int-attributes.c:252
> hp_populate_integer_elements_from_package() error: uninitialized symbol
> 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/int-attributes.c:255
> hp_populate_integer_elements_from_package() error: uninitialized symbol
> 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c:180
> hp_populate_enumeration_elements_from_package() error: uninitialized
> symbol 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c:183
> hp_populate_enumeration_elements_from_package() error: uninitialized
> symbol 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c:186
> hp_populate_enumeration_elements_from_package() error: uninitialized
> symbol 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c:189
> hp_populate_enumeration_elements_from_package() error: uninitialized
> symbol 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c:192
> hp_populate_enumeration_elements_from_package() error: uninitialized
> symbol 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c:231
> hp_populate_enumeration_elements_from_package() error: uninitialized
> symbol 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c:239
> hp_populate_enumeration_elements_from_package() error: uninitialized
> symbol 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c:279
> hp_populate_password_elements_from_package() error: uninitialized
> symbol 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c:282
> hp_populate_password_elements_from_package() error: uninitialized
> symbol 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c:285
> hp_populate_password_elements_from_package() error: uninitialized
> symbol 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c:288
> hp_populate_password_elements_from_package() error: uninitialized
> symbol 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c:291
> hp_populate_password_elements_from_package() error: uninitialized
> symbol 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c:324
> hp_populate_password_elements_from_package() error: uninitialized
> symbol 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c:327
> hp_populate_password_elements_from_package() error: uninitialized
> symbol 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c:330
> hp_populate_password_elements_from_package() error: uninitialized
> symbol 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c:333
> hp_populate_password_elements_from_package() error: uninitialized
> symbol 'int_value'.
> > drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c:362
> hp_populate_password_elements_from_package() error: uninitialized
> symbol 'int_value'.
> >


  reply	other threads:[~2023-07-25 20:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-17 20:53 Christophe JAILLET
2023-07-18  7:55 ` Dan Carpenter
2023-07-18 17:36   ` Christophe JAILLET
2023-07-25 20:00     ` Lopez, Jorge A (Security) [this message]
2023-07-25 19:48 ` Lopez, Jorge A (Security)

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=PH0PR84MB19533DF0CE1E2F5951031150A803A@PH0PR84MB1953.NAMPRD84.PROD.OUTLOOK.COM \
    --to=jorge.lopez2@hp.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=dan.carpenter@linaro.org \
    --cc=hdegoede@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=markgross@kernel.org \
    --cc=platform-driver-x86@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 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®