All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] EDAC: octeon: Fix uninitialized variable warning
@ 2017-11-13 16:12 ` James Hogan
  0 siblings, 0 replies; 7+ messages in thread
From: James Hogan @ 2017-11-13 16:12 UTC (permalink / raw)
  To: David Daney, Ralf Baechle, Daniel Walker
  Cc: James Hogan, Borislav Petkov, Mauro Carvalho Chehab,
	Steven J . Hill, linux-edac, linux-mips, stable

From: James Hogan <jhogan@kernel.org>

Fix uninitialized variable warning in the Octeon EDAC driver, as seen in
MIPS cavium_octeon_defconfig builds since v4.14 with Codescape GNU Tools
2016.05-03:

drivers/edac/octeon_edac-lmc.c In function ‘octeon_lmc_edac_poll_o2’:
drivers/edac/octeon_edac-lmc.c:87:24: warning: ‘((long unsigned int*)&int_reg)[1]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  if (int_reg.s.sec_err || int_reg.s.ded_err) {
                        ^

This was introduced in commit 1bc021e81565 ("EDAC: Octeon: Add error
injection support"), and is fixed by initialising the whole int_reg
variable to zero before the conditional assignments in the error
injection case.

Fixes: 1bc021e81565 ("EDAC: Octeon: Add error injection support")
Signed-off-by: James Hogan <jhogan@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: David Daney <david.daney@cavium.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Daniel Walker <dwalker@fifo99.com>
Cc: Steven J. Hill <steven.hill@cavium.com>
Cc: linux-edac@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: <stable@vger.kernel.org> # 3.15+
---
Comments appreciated. Is this correct?

I've added the stable tag on the assumption that this might matter. If
not it can be changed. It'd be nice to have it in 4.14 though to silence
the warning since the driver was added to cavium_octeon_defconfig in
commit f922bc0ad08b ("MIPS: Octeon: cavium_octeon_defconfig: Enable more
drivers").
---
 drivers/edac/octeon_edac-lmc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/edac/octeon_edac-lmc.c b/drivers/edac/octeon_edac-lmc.c
index 9c1ffe3e912b..aeb222ca3ed1 100644
--- a/drivers/edac/octeon_edac-lmc.c
+++ b/drivers/edac/octeon_edac-lmc.c
@@ -78,6 +78,7 @@ static void octeon_lmc_edac_poll_o2(struct mem_ctl_info *mci)
 	if (!pvt->inject)
 		int_reg.u64 = cvmx_read_csr(CVMX_LMCX_INT(mci->mc_idx));
 	else {
+		int_reg.u64 = 0;
 		if (pvt->error_type == 1)
 			int_reg.s.sec_err = 1;
 		if (pvt->error_type == 2)

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

* [PATCH RFC] EDAC: octeon: Fix uninitialized variable warning
@ 2017-11-13 16:12 ` James Hogan
  0 siblings, 0 replies; 7+ messages in thread
From: James Hogan @ 2017-11-13 16:12 UTC (permalink / raw)
  To: David Daney, Ralf Baechle, Daniel Walker
  Cc: James Hogan, Borislav Petkov, Mauro Carvalho Chehab,
	Steven J . Hill, linux-edac, linux-mips, stable

From: James Hogan <jhogan@kernel.org>

Fix uninitialized variable warning in the Octeon EDAC driver, as seen in
MIPS cavium_octeon_defconfig builds since v4.14 with Codescape GNU Tools
2016.05-03:

drivers/edac/octeon_edac-lmc.c In function ‘octeon_lmc_edac_poll_o2’:
drivers/edac/octeon_edac-lmc.c:87:24: warning: ‘((long unsigned int*)&int_reg)[1]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  if (int_reg.s.sec_err || int_reg.s.ded_err) {
                        ^

This was introduced in commit 1bc021e81565 ("EDAC: Octeon: Add error
injection support"), and is fixed by initialising the whole int_reg
variable to zero before the conditional assignments in the error
injection case.

Fixes: 1bc021e81565 ("EDAC: Octeon: Add error injection support")
Signed-off-by: James Hogan <jhogan@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: David Daney <david.daney@cavium.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Daniel Walker <dwalker@fifo99.com>
Cc: Steven J. Hill <steven.hill@cavium.com>
Cc: linux-edac@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: <stable@vger.kernel.org> # 3.15+
---
Comments appreciated. Is this correct?

I've added the stable tag on the assumption that this might matter. If
not it can be changed. It'd be nice to have it in 4.14 though to silence
the warning since the driver was added to cavium_octeon_defconfig in
commit f922bc0ad08b ("MIPS: Octeon: cavium_octeon_defconfig: Enable more
drivers").
---
 drivers/edac/octeon_edac-lmc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/edac/octeon_edac-lmc.c b/drivers/edac/octeon_edac-lmc.c
index 9c1ffe3e912b..aeb222ca3ed1 100644
--- a/drivers/edac/octeon_edac-lmc.c
+++ b/drivers/edac/octeon_edac-lmc.c
@@ -78,6 +78,7 @@ static void octeon_lmc_edac_poll_o2(struct mem_ctl_info *mci)
 	if (!pvt->inject)
 		int_reg.u64 = cvmx_read_csr(CVMX_LMCX_INT(mci->mc_idx));
 	else {
+		int_reg.u64 = 0;
 		if (pvt->error_type == 1)
 			int_reg.s.sec_err = 1;
 		if (pvt->error_type == 2)
-- 
2.14.1

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

* [PATCH RFC] EDAC: octeon: Fix uninitialized variable warning
@ 2017-11-13 16:12 ` James Hogan
  0 siblings, 0 replies; 7+ messages in thread
From: James Hogan @ 2017-11-13 16:12 UTC (permalink / raw)
  To: David Daney, Ralf Baechle, Daniel Walker
  Cc: James Hogan, Borislav Petkov, Mauro Carvalho Chehab,
	Steven J . Hill, linux-edac, linux-mips, stable

From: James Hogan <jhogan@kernel.org>

Fix uninitialized variable warning in the Octeon EDAC driver, as seen in
MIPS cavium_octeon_defconfig builds since v4.14 with Codescape GNU Tools
2016.05-03:

drivers/edac/octeon_edac-lmc.c In function ‘octeon_lmc_edac_poll_o2’:
drivers/edac/octeon_edac-lmc.c:87:24: warning: ‘((long unsigned int*)&int_reg)[1]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  if (int_reg.s.sec_err || int_reg.s.ded_err) {
                        ^

This was introduced in commit 1bc021e81565 ("EDAC: Octeon: Add error
injection support"), and is fixed by initialising the whole int_reg
variable to zero before the conditional assignments in the error
injection case.

Fixes: 1bc021e81565 ("EDAC: Octeon: Add error injection support")
Signed-off-by: James Hogan <jhogan@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: David Daney <david.daney@cavium.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Daniel Walker <dwalker@fifo99.com>
Cc: Steven J. Hill <steven.hill@cavium.com>
Cc: linux-edac@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: <stable@vger.kernel.org> # 3.15+
---
Comments appreciated. Is this correct?

I've added the stable tag on the assumption that this might matter. If
not it can be changed. It'd be nice to have it in 4.14 though to silence
the warning since the driver was added to cavium_octeon_defconfig in
commit f922bc0ad08b ("MIPS: Octeon: cavium_octeon_defconfig: Enable more
drivers").
---
 drivers/edac/octeon_edac-lmc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/edac/octeon_edac-lmc.c b/drivers/edac/octeon_edac-lmc.c
index 9c1ffe3e912b..aeb222ca3ed1 100644
--- a/drivers/edac/octeon_edac-lmc.c
+++ b/drivers/edac/octeon_edac-lmc.c
@@ -78,6 +78,7 @@ static void octeon_lmc_edac_poll_o2(struct mem_ctl_info *mci)
 	if (!pvt->inject)
 		int_reg.u64 = cvmx_read_csr(CVMX_LMCX_INT(mci->mc_idx));
 	else {
+		int_reg.u64 = 0;
 		if (pvt->error_type == 1)
 			int_reg.s.sec_err = 1;
 		if (pvt->error_type == 2)
-- 
2.14.1

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

* [RFC] EDAC: octeon: Fix uninitialized variable warning
  2017-11-13 16:12 ` James Hogan
@ 2017-11-13 17:48 ` David Daney
  -1 siblings, 0 replies; 7+ messages in thread
From: David Daney @ 2017-11-13 17:48 UTC (permalink / raw)
  To: James Hogan, David Daney, Ralf Baechle, Daniel Walker
  Cc: James Hogan, Borislav Petkov, Mauro Carvalho Chehab,
	Steven J . Hill, linux-edac, linux-mips, stable

On 11/13/2017 08:12 AM, James Hogan wrote:
> From: James Hogan <jhogan@kernel.org>
> 
> Fix uninitialized variable warning in the Octeon EDAC driver, as seen in
> MIPS cavium_octeon_defconfig builds since v4.14 with Codescape GNU Tools
> 2016.05-03:
> 
> drivers/edac/octeon_edac-lmc.c In function ‘octeon_lmc_edac_poll_o2’:
> drivers/edac/octeon_edac-lmc.c:87:24: warning: ‘((long unsigned int*)&int_reg)[1]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>    if (int_reg.s.sec_err || int_reg.s.ded_err) {
>                          ^
> 
> This was introduced in commit 1bc021e81565 ("EDAC: Octeon: Add error
> injection support"), and is fixed by initialising the whole int_reg
> variable to zero before the conditional assignments in the error
> injection case.
> 
> Fixes: 1bc021e81565 ("EDAC: Octeon: Add error injection support")
> Signed-off-by: James Hogan <jhogan@kernel.org>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: David Daney <david.daney@cavium.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Cc: Daniel Walker <dwalker@fifo99.com>
> Cc: Steven J. Hill <steven.hill@cavium.com>
> Cc: linux-edac@vger.kernel.org
> Cc: linux-mips@linux-mips.org
> Cc: <stable@vger.kernel.org> # 3.15+

Thanks, this looks correct,

Acked-by: David Daney <david.daney@cavium.com>


> ---
> Comments appreciated. Is this correct?
> 
> I've added the stable tag on the assumption that this might matter. If
> not it can be changed. It'd be nice to have it in 4.14 though to silence
> the warning since the driver was added to cavium_octeon_defconfig in
> commit f922bc0ad08b ("MIPS: Octeon: cavium_octeon_defconfig: Enable more
> drivers").
> ---
>   drivers/edac/octeon_edac-lmc.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/edac/octeon_edac-lmc.c b/drivers/edac/octeon_edac-lmc.c
> index 9c1ffe3e912b..aeb222ca3ed1 100644
> --- a/drivers/edac/octeon_edac-lmc.c
> +++ b/drivers/edac/octeon_edac-lmc.c
> @@ -78,6 +78,7 @@ static void octeon_lmc_edac_poll_o2(struct mem_ctl_info *mci)
>   	if (!pvt->inject)
>   		int_reg.u64 = cvmx_read_csr(CVMX_LMCX_INT(mci->mc_idx));
>   	else {
> +		int_reg.u64 = 0;
>   		if (pvt->error_type == 1)
>   			int_reg.s.sec_err = 1;
>   		if (pvt->error_type == 2)
>
---
To unsubscribe from this list: send the line "unsubscribe linux-edac" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH RFC] EDAC: octeon: Fix uninitialized variable warning
@ 2017-11-13 17:48 ` David Daney
  0 siblings, 0 replies; 7+ messages in thread
From: David Daney @ 2017-11-13 17:48 UTC (permalink / raw)
  To: James Hogan, David Daney, Ralf Baechle, Daniel Walker
  Cc: James Hogan, Borislav Petkov, Mauro Carvalho Chehab,
	Steven J . Hill, linux-edac, linux-mips, stable

On 11/13/2017 08:12 AM, James Hogan wrote:
> From: James Hogan <jhogan@kernel.org>
> 
> Fix uninitialized variable warning in the Octeon EDAC driver, as seen in
> MIPS cavium_octeon_defconfig builds since v4.14 with Codescape GNU Tools
> 2016.05-03:
> 
> drivers/edac/octeon_edac-lmc.c In function ‘octeon_lmc_edac_poll_o2’:
> drivers/edac/octeon_edac-lmc.c:87:24: warning: ‘((long unsigned int*)&int_reg)[1]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>    if (int_reg.s.sec_err || int_reg.s.ded_err) {
>                          ^
> 
> This was introduced in commit 1bc021e81565 ("EDAC: Octeon: Add error
> injection support"), and is fixed by initialising the whole int_reg
> variable to zero before the conditional assignments in the error
> injection case.
> 
> Fixes: 1bc021e81565 ("EDAC: Octeon: Add error injection support")
> Signed-off-by: James Hogan <jhogan@kernel.org>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: David Daney <david.daney@cavium.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Cc: Daniel Walker <dwalker@fifo99.com>
> Cc: Steven J. Hill <steven.hill@cavium.com>
> Cc: linux-edac@vger.kernel.org
> Cc: linux-mips@linux-mips.org
> Cc: <stable@vger.kernel.org> # 3.15+

Thanks, this looks correct,

Acked-by: David Daney <david.daney@cavium.com>


> ---
> Comments appreciated. Is this correct?
> 
> I've added the stable tag on the assumption that this might matter. If
> not it can be changed. It'd be nice to have it in 4.14 though to silence
> the warning since the driver was added to cavium_octeon_defconfig in
> commit f922bc0ad08b ("MIPS: Octeon: cavium_octeon_defconfig: Enable more
> drivers").
> ---
>   drivers/edac/octeon_edac-lmc.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/edac/octeon_edac-lmc.c b/drivers/edac/octeon_edac-lmc.c
> index 9c1ffe3e912b..aeb222ca3ed1 100644
> --- a/drivers/edac/octeon_edac-lmc.c
> +++ b/drivers/edac/octeon_edac-lmc.c
> @@ -78,6 +78,7 @@ static void octeon_lmc_edac_poll_o2(struct mem_ctl_info *mci)
>   	if (!pvt->inject)
>   		int_reg.u64 = cvmx_read_csr(CVMX_LMCX_INT(mci->mc_idx));
>   	else {
> +		int_reg.u64 = 0;
>   		if (pvt->error_type == 1)
>   			int_reg.s.sec_err = 1;
>   		if (pvt->error_type == 2)
> 

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

* [RFC] EDAC: octeon: Fix uninitialized variable warning
  2017-11-13 16:12 ` James Hogan
@ 2017-11-27 12:36 ` Borislav Petkov
  -1 siblings, 0 replies; 7+ messages in thread
From: Borislav Petkov @ 2017-11-27 12:36 UTC (permalink / raw)
  To: James Hogan
  Cc: David Daney, Ralf Baechle, Daniel Walker, James Hogan,
	Mauro Carvalho Chehab, Steven J . Hill, linux-edac, linux-mips,
	stable

On Mon, Nov 13, 2017 at 04:12:06PM +0000, James Hogan wrote:
> From: James Hogan <jhogan@kernel.org>
> 
> Fix uninitialized variable warning in the Octeon EDAC driver, as seen in
> MIPS cavium_octeon_defconfig builds since v4.14 with Codescape GNU Tools
> 2016.05-03:
> 
> drivers/edac/octeon_edac-lmc.c In function ‘octeon_lmc_edac_poll_o2’:
> drivers/edac/octeon_edac-lmc.c:87:24: warning: ‘((long unsigned int*)&int_reg)[1]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>   if (int_reg.s.sec_err || int_reg.s.ded_err) {
>                         ^
> 
> This was introduced in commit 1bc021e81565 ("EDAC: Octeon: Add error
> injection support"), and is fixed by initialising the whole int_reg
> variable to zero before the conditional assignments in the error
> injection case.
> 
> Fixes: 1bc021e81565 ("EDAC: Octeon: Add error injection support")
> Signed-off-by: James Hogan <jhogan@kernel.org>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: David Daney <david.daney@cavium.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Cc: Daniel Walker <dwalker@fifo99.com>
> Cc: Steven J. Hill <steven.hill@cavium.com>
> Cc: linux-edac@vger.kernel.org
> Cc: linux-mips@linux-mips.org
> Cc: <stable@vger.kernel.org> # 3.15+
> ---
> Comments appreciated. Is this correct?
> 
> I've added the stable tag on the assumption that this might matter. If
> not it can be changed. It'd be nice to have it in 4.14 though to silence
> the warning since the driver was added to cavium_octeon_defconfig in
> commit f922bc0ad08b ("MIPS: Octeon: cavium_octeon_defconfig: Enable more
> drivers").
> ---
>  drivers/edac/octeon_edac-lmc.c | 1 +
>  1 file changed, 1 insertion(+)

Applied, thanks.

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

* Re: [PATCH RFC] EDAC: octeon: Fix uninitialized variable warning
@ 2017-11-27 12:36 ` Borislav Petkov
  0 siblings, 0 replies; 7+ messages in thread
From: Borislav Petkov @ 2017-11-27 12:36 UTC (permalink / raw)
  To: James Hogan
  Cc: David Daney, Ralf Baechle, Daniel Walker, James Hogan,
	Mauro Carvalho Chehab, Steven J . Hill, linux-edac, linux-mips,
	stable

On Mon, Nov 13, 2017 at 04:12:06PM +0000, James Hogan wrote:
> From: James Hogan <jhogan@kernel.org>
> 
> Fix uninitialized variable warning in the Octeon EDAC driver, as seen in
> MIPS cavium_octeon_defconfig builds since v4.14 with Codescape GNU Tools
> 2016.05-03:
> 
> drivers/edac/octeon_edac-lmc.c In function ‘octeon_lmc_edac_poll_o2’:
> drivers/edac/octeon_edac-lmc.c:87:24: warning: ‘((long unsigned int*)&int_reg)[1]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>   if (int_reg.s.sec_err || int_reg.s.ded_err) {
>                         ^
> 
> This was introduced in commit 1bc021e81565 ("EDAC: Octeon: Add error
> injection support"), and is fixed by initialising the whole int_reg
> variable to zero before the conditional assignments in the error
> injection case.
> 
> Fixes: 1bc021e81565 ("EDAC: Octeon: Add error injection support")
> Signed-off-by: James Hogan <jhogan@kernel.org>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: David Daney <david.daney@cavium.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Cc: Daniel Walker <dwalker@fifo99.com>
> Cc: Steven J. Hill <steven.hill@cavium.com>
> Cc: linux-edac@vger.kernel.org
> Cc: linux-mips@linux-mips.org
> Cc: <stable@vger.kernel.org> # 3.15+
> ---
> Comments appreciated. Is this correct?
> 
> I've added the stable tag on the assumption that this might matter. If
> not it can be changed. It'd be nice to have it in 4.14 though to silence
> the warning since the driver was added to cavium_octeon_defconfig in
> commit f922bc0ad08b ("MIPS: Octeon: cavium_octeon_defconfig: Enable more
> drivers").
> ---
>  drivers/edac/octeon_edac-lmc.c | 1 +
>  1 file changed, 1 insertion(+)

Applied, thanks.

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

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

end of thread, other threads:[~2017-11-27 12:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-27 12:36 [RFC] EDAC: octeon: Fix uninitialized variable warning Borislav Petkov
2017-11-27 12:36 ` [PATCH RFC] " Borislav Petkov
  -- strict thread matches above, loose matches on Subject: below --
2017-11-13 17:48 [RFC] " David Daney
2017-11-13 17:48 ` [PATCH RFC] " David Daney
2017-11-13 16:12 [RFC] " James Hogan
2017-11-13 16:12 ` [PATCH RFC] " James Hogan
2017-11-13 16:12 ` James Hogan

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.