From: Bjorn Helgaas <helgaas@kernel.org>
To: Colin King <colin.king@canonical.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Tyrel Datwyler <tyreld@linux.vnet.ibm.com>,
linuxppc-dev@lists.ozlabs.org, linux-pci@vger.kernel.org,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
Michael Bringmann <mwb@linux.vnet.ibm.com>
Subject: Re: [PATCH] hotplug/drc-info: ininitialize fndit to zero
Date: Wed, 20 Mar 2019 22:12:57 +0000 [thread overview]
Message-ID: <20190320221257.GI251185@google.com> (raw)
In-Reply-To: <20190316214016.6612-1-colin.king@canonical.com>
[+cc Michael B (original author)]
On Sat, Mar 16, 2019 at 09:40:16PM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently variable fndit is not initialized and contains a
> garbage value, later it is set to 1 if a drc entry is found.
> Ensure fndit is not containing garbage by initializing it to
> zero. Also remove an extraneous space at the end of an
> sprintf call.
>
> Detected by static analysis with cppcheck.
>
> Fixes: 2fcf3ae508c2 ("hotplug/drc-info: Add code to search ibm,drc-info property")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Michael E, I assume you'll take this since you took the original?
Let me know if you want me to.
> ---
> drivers/pci/hotplug/rpaphp_core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
> index bcd5d357ca23..28213f44f64a 100644
> --- a/drivers/pci/hotplug/rpaphp_core.c
> +++ b/drivers/pci/hotplug/rpaphp_core.c
> @@ -230,7 +230,7 @@ static int rpaphp_check_drc_props_v2(struct device_node *dn, char *drc_name,
> struct of_drc_info drc;
> const __be32 *value;
> char cell_drc_name[MAX_DRC_NAME_LEN];
> - int j, fndit;
> + int j, fndit = 0;
>
> info = of_find_property(dn->parent, "ibm,drc-info", NULL);
> if (info = NULL)
> @@ -254,7 +254,7 @@ static int rpaphp_check_drc_props_v2(struct device_node *dn, char *drc_name,
> /* Found it */
>
> if (fndit)
> - sprintf(cell_drc_name, "%s%d", drc.drc_name_prefix,
> + sprintf(cell_drc_name, "%s%d", drc.drc_name_prefix,
> my_index);
>
> if (((drc_name = NULL) ||
> --
> 2.20.1
>
WARNING: multiple messages have this Message-ID (diff)
From: Bjorn Helgaas <helgaas@kernel.org>
To: Colin King <colin.king@canonical.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Tyrel Datwyler <tyreld@linux.vnet.ibm.com>,
linuxppc-dev@lists.ozlabs.org, linux-pci@vger.kernel.org,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
Michael Bringmann <mwb@linux.vnet.ibm.com>
Subject: Re: [PATCH] hotplug/drc-info: ininitialize fndit to zero
Date: Wed, 20 Mar 2019 17:12:57 -0500 [thread overview]
Message-ID: <20190320221257.GI251185@google.com> (raw)
In-Reply-To: <20190316214016.6612-1-colin.king@canonical.com>
[+cc Michael B (original author)]
On Sat, Mar 16, 2019 at 09:40:16PM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently variable fndit is not initialized and contains a
> garbage value, later it is set to 1 if a drc entry is found.
> Ensure fndit is not containing garbage by initializing it to
> zero. Also remove an extraneous space at the end of an
> sprintf call.
>
> Detected by static analysis with cppcheck.
>
> Fixes: 2fcf3ae508c2 ("hotplug/drc-info: Add code to search ibm,drc-info property")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Michael E, I assume you'll take this since you took the original?
Let me know if you want me to.
> ---
> drivers/pci/hotplug/rpaphp_core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
> index bcd5d357ca23..28213f44f64a 100644
> --- a/drivers/pci/hotplug/rpaphp_core.c
> +++ b/drivers/pci/hotplug/rpaphp_core.c
> @@ -230,7 +230,7 @@ static int rpaphp_check_drc_props_v2(struct device_node *dn, char *drc_name,
> struct of_drc_info drc;
> const __be32 *value;
> char cell_drc_name[MAX_DRC_NAME_LEN];
> - int j, fndit;
> + int j, fndit = 0;
>
> info = of_find_property(dn->parent, "ibm,drc-info", NULL);
> if (info == NULL)
> @@ -254,7 +254,7 @@ static int rpaphp_check_drc_props_v2(struct device_node *dn, char *drc_name,
> /* Found it */
>
> if (fndit)
> - sprintf(cell_drc_name, "%s%d", drc.drc_name_prefix,
> + sprintf(cell_drc_name, "%s%d", drc.drc_name_prefix,
> my_index);
>
> if (((drc_name == NULL) ||
> --
> 2.20.1
>
WARNING: multiple messages have this Message-ID (diff)
From: Bjorn Helgaas <helgaas@kernel.org>
To: Colin King <colin.king@canonical.com>
Cc: linux-pci@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-kernel@vger.kernel.org,
Michael Bringmann <mwb@linux.vnet.ibm.com>,
Paul Mackerras <paulus@samba.org>,
Tyrel Datwyler <tyreld@linux.vnet.ibm.com>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] hotplug/drc-info: ininitialize fndit to zero
Date: Wed, 20 Mar 2019 17:12:57 -0500 [thread overview]
Message-ID: <20190320221257.GI251185@google.com> (raw)
In-Reply-To: <20190316214016.6612-1-colin.king@canonical.com>
[+cc Michael B (original author)]
On Sat, Mar 16, 2019 at 09:40:16PM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently variable fndit is not initialized and contains a
> garbage value, later it is set to 1 if a drc entry is found.
> Ensure fndit is not containing garbage by initializing it to
> zero. Also remove an extraneous space at the end of an
> sprintf call.
>
> Detected by static analysis with cppcheck.
>
> Fixes: 2fcf3ae508c2 ("hotplug/drc-info: Add code to search ibm,drc-info property")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Michael E, I assume you'll take this since you took the original?
Let me know if you want me to.
> ---
> drivers/pci/hotplug/rpaphp_core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
> index bcd5d357ca23..28213f44f64a 100644
> --- a/drivers/pci/hotplug/rpaphp_core.c
> +++ b/drivers/pci/hotplug/rpaphp_core.c
> @@ -230,7 +230,7 @@ static int rpaphp_check_drc_props_v2(struct device_node *dn, char *drc_name,
> struct of_drc_info drc;
> const __be32 *value;
> char cell_drc_name[MAX_DRC_NAME_LEN];
> - int j, fndit;
> + int j, fndit = 0;
>
> info = of_find_property(dn->parent, "ibm,drc-info", NULL);
> if (info == NULL)
> @@ -254,7 +254,7 @@ static int rpaphp_check_drc_props_v2(struct device_node *dn, char *drc_name,
> /* Found it */
>
> if (fndit)
> - sprintf(cell_drc_name, "%s%d", drc.drc_name_prefix,
> + sprintf(cell_drc_name, "%s%d", drc.drc_name_prefix,
> my_index);
>
> if (((drc_name == NULL) ||
> --
> 2.20.1
>
next prev parent reply other threads:[~2019-03-20 22:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-16 21:40 [PATCH] hotplug/drc-info: ininitialize fndit to zero Colin King
2019-03-16 21:40 ` Colin King
2019-03-20 22:12 ` Bjorn Helgaas [this message]
2019-03-20 22:12 ` Bjorn Helgaas
2019-03-20 22:12 ` Bjorn Helgaas
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=20190320221257.GI251185@google.com \
--to=helgaas@kernel.org \
--cc=benh@kernel.crashing.org \
--cc=colin.king@canonical.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=mwb@linux.vnet.ibm.com \
--cc=paulus@samba.org \
--cc=tyreld@linux.vnet.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.