From: Ferruh Yigit <ferruh.yigit@intel.com>
To: "Xu, Rosen" <rosen.xu@intel.com>,
"Walsh, Conor" <conor.walsh@intel.com>,
"Zhang, Tianfei" <tianfei.zhang@intel.com>,
"Pei, Andy" <andy.pei@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
"stable@dpdk.org" <stable@dpdk.org>,
"Chen, LingliX" <linglix.chen@intel.com>
Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] raw/ifpga/base: fix uninitialized variables gcc warning
Date: Mon, 23 Nov 2020 17:18:25 +0000 [thread overview]
Message-ID: <7c5d09fc-7f7b-7f28-723b-2b5066baa286@intel.com> (raw)
In-Reply-To: <BYAPR11MB2901875C803B14588DBEA47F89FF0@BYAPR11MB2901.namprd11.prod.outlook.com>
On 11/20/2020 1:22 AM, Xu, Rosen wrote:
> Hi,
>
>
>> -----Original Message-----
>> From: Walsh, Conor <conor.walsh@intel.com>
>> Sent: Thursday, November 19, 2020 23:00
>> To: Xu, Rosen <rosen.xu@intel.com>; Zhang, Tianfei
>> <tianfei.zhang@intel.com>; Pei, Andy <andy.pei@intel.com>
>> Cc: dev@dpdk.org; stable@dpdk.org; Chen, LingliX <linglix.chen@intel.com>;
>> Walsh, Conor <conor.walsh@intel.com>
>> Subject: [PATCH] raw/ifpga/base: fix uninitialized variables gcc warning
>>
>> On Ubuntu 18.04 using gcc 7.5, gcc sees size and start as possibly being
>> uninitialized. This patch initialises size and start to correct this warning.
>>
>> Exact warning:
>> ../drivers/raw/ifpga/base/opae_intel_max10.c:488:22: warning: ‘size’
>> may be used uninitialized in this function [-Wmaybe-uninitialized]
>> raw->regs[i].size = size;
>> ../drivers/raw/ifpga/base/opae_intel_max10.c:484:25: warning: ‘start’
>> may be used uninitialized in this function [-Wmaybe-uninitialized]
>> raw->regs[i].regoff = start;
>>
>> Fixes: 45f301724ba7 ("raw/ifpga/base: support sensor")
>>
>> Signed-off-by: Conor Walsh <conor.walsh@intel.com>
>> ---
>> drivers/raw/ifpga/base/opae_intel_max10.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/raw/ifpga/base/opae_intel_max10.c
>> b/drivers/raw/ifpga/base/opae_intel_max10.c
>> index 1a526ea549..1c12a85195 100644
>> --- a/drivers/raw/ifpga/base/opae_intel_max10.c
>> +++ b/drivers/raw/ifpga/base/opae_intel_max10.c
>> @@ -418,7 +418,7 @@ max10_sensor_init(struct intel_max10_device *dev,
>> int parent)
>> int i, ret = 0, offset = 0;
>> const fdt32_t *num;
>> const char *ptr;
>> - u64 start, size;
>> + u64 start = 0, size = 0;
>> struct raw_sensor_info *raw;
>> struct opae_sensor_info *sensor;
>> char *fdt_root = dev->fdt_root;
>> --
>> 2.25.1
>
> Reviewed-by: Rosen Xu <rosen.xu@intel.com>
>
This also looks a compiler false positive, at least it would be good to
highlight in the commit log that you are not fixing the code but false compiler
warning.
And since the code is not in the data path, I guess it is OK to add
initialization to silence the compiler.
But if the warnings doesn't break the build but just warnings, leaving them as
it is also an option I think.
next prev parent reply other threads:[~2020-11-23 17:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-19 15:00 [dpdk-stable] " Conor Walsh
2020-11-20 1:22 ` Xu, Rosen
2020-11-23 17:18 ` Ferruh Yigit [this message]
2020-11-20 7:28 ` Chen, LingliX
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=7c5d09fc-7f7b-7f28-723b-2b5066baa286@intel.com \
--to=ferruh.yigit@intel.com \
--cc=andy.pei@intel.com \
--cc=conor.walsh@intel.com \
--cc=dev@dpdk.org \
--cc=linglix.chen@intel.com \
--cc=rosen.xu@intel.com \
--cc=stable@dpdk.org \
--cc=tianfei.zhang@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;
as well as URLs for NNTP newsgroup(s).