patches for DPDK stable branches
 help / color / Atom feed
* [dpdk-stable] [PATCH] raw/ifpga/base: fix uninitialized variables gcc warning
@ 2020-11-19 15:00 Conor Walsh
  2020-11-20  1:22 ` Xu, Rosen
  2020-11-20  7:28 ` [dpdk-stable] " Chen, LingliX
  0 siblings, 2 replies; 4+ messages in thread
From: Conor Walsh @ 2020-11-19 15:00 UTC (permalink / raw)
  To: rosen.xu, tianfei.zhang, andy.pei; +Cc: dev, stable, linglix.chen, Conor Walsh

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-stable] [PATCH] raw/ifpga/base: fix uninitialized variables gcc warning
  2020-11-19 15:00 [dpdk-stable] [PATCH] raw/ifpga/base: fix uninitialized variables gcc warning Conor Walsh
@ 2020-11-20  1:22 ` Xu, Rosen
  2020-11-23 17:18   ` [dpdk-stable] [dpdk-dev] " Ferruh Yigit
  2020-11-20  7:28 ` [dpdk-stable] " Chen, LingliX
  1 sibling, 1 reply; 4+ messages in thread
From: Xu, Rosen @ 2020-11-20  1:22 UTC (permalink / raw)
  To: Walsh, Conor, Zhang, Tianfei, Pei, Andy; +Cc: dev, stable, Chen,  LingliX

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>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-stable] [PATCH] raw/ifpga/base: fix uninitialized variables gcc warning
  2020-11-19 15:00 [dpdk-stable] [PATCH] raw/ifpga/base: fix uninitialized variables gcc warning Conor Walsh
  2020-11-20  1:22 ` Xu, Rosen
@ 2020-11-20  7:28 ` " Chen, LingliX
  1 sibling, 0 replies; 4+ messages in thread
From: Chen, LingliX @ 2020-11-20  7:28 UTC (permalink / raw)
  To: Walsh, Conor, Xu, Rosen, Zhang, Tianfei, Pei, Andy; +Cc: dev, stable

Tested-by:  Chen, LingliX <linglix.chen@intel.com>

Regards,
Chen, LingliX

> -----Original Message-----
> From: Walsh, Conor
> Sent: Thursday, November 19, 2020 11:00 PM
> 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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH] raw/ifpga/base: fix uninitialized variables gcc warning
  2020-11-20  1:22 ` Xu, Rosen
@ 2020-11-23 17:18   ` " Ferruh Yigit
  0 siblings, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2020-11-23 17:18 UTC (permalink / raw)
  To: Xu, Rosen, Walsh, Conor, Zhang, Tianfei, Pei, Andy
  Cc: dev, stable, Chen, LingliX

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-19 15:00 [dpdk-stable] [PATCH] raw/ifpga/base: fix uninitialized variables gcc warning Conor Walsh
2020-11-20  1:22 ` Xu, Rosen
2020-11-23 17:18   ` [dpdk-stable] [dpdk-dev] " Ferruh Yigit
2020-11-20  7:28 ` [dpdk-stable] " Chen, LingliX

patches for DPDK stable branches

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/ public-inbox