* [PATCH] arch: tile: kernel: unaligned.c: Cleaning up uninitialized variables
@ 2014-05-31 23:00 Rickard Strandqvist
2014-06-08 1:41 ` Chris Metcalf
0 siblings, 1 reply; 3+ messages in thread
From: Rickard Strandqvist @ 2014-05-31 23:00 UTC (permalink / raw)
To: Chris Metcalf, Rickard Strandqvist; +Cc: linux-kernel
There is a risk that the variable will be used without being initialized.
This was largely found by using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
arch/tile/kernel/unaligned.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/tile/kernel/unaligned.c b/arch/tile/kernel/unaligned.c
index b030b4e..ce475dd 100644
--- a/arch/tile/kernel/unaligned.c
+++ b/arch/tile/kernel/unaligned.c
@@ -569,7 +569,7 @@ void jit_bundle_gen(struct pt_regs *regs, tilegx_bundle_bits bundle,
tilegx_bundle_bits bundle_2 = 0;
/* If bundle_2_enable = false, bundle_2 is fnop/nop operation. */
bool bundle_2_enable = true;
- uint64_t ra, rb, rd = -1, clob1, clob2, clob3;
+ uint64_t ra = 0, rb = 0, rd = -1, clob1 = 0, clob2 = 0, clob3 = 0;
/*
* Indicate if the unalign access
* instruction's registers hit with
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] arch: tile: kernel: unaligned.c: Cleaning up uninitialized variables
2014-05-31 23:00 [PATCH] arch: tile: kernel: unaligned.c: Cleaning up uninitialized variables Rickard Strandqvist
@ 2014-06-08 1:41 ` Chris Metcalf
2014-06-08 17:17 ` Rickard Strandqvist
0 siblings, 1 reply; 3+ messages in thread
From: Chris Metcalf @ 2014-06-08 1:41 UTC (permalink / raw)
To: Rickard Strandqvist; +Cc: linux-kernel
On 5/31/2014 7:00 PM, Rickard Strandqvist wrote:
> There is a risk that the variable will be used without being initialized.
>
> This was largely found by using a static code analysis program called cppcheck.
>
> Signed-off-by: Rickard Strandqvist<rickard_strandqvist@spectrumdigital.se>
> ---
> arch/tile/kernel/unaligned.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Thanks! Taken into the tile tree with some slight modifications (initialize variables to -1 not 0, and remove the resulting dead code in find_regs).
--
Chris Metcalf, Tilera Corp.
http://www.tilera.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] arch: tile: kernel: unaligned.c: Cleaning up uninitialized variables
2014-06-08 1:41 ` Chris Metcalf
@ 2014-06-08 17:17 ` Rickard Strandqvist
0 siblings, 0 replies; 3+ messages in thread
From: Rickard Strandqvist @ 2014-06-08 17:17 UTC (permalink / raw)
To: Chris Metcalf; +Cc: linux-kernel@vger.kernel.org
Hi Chris
So uint max was a better default value.
Yeah, good it came into use. The main thing that the code got a proper review :)
Kind regards
Rickard Strandqvist
2014-06-08 3:41 GMT+02:00 Chris Metcalf <cmetcalf@tilera.com>:
> On 5/31/2014 7:00 PM, Rickard Strandqvist wrote:
>>
>> There is a risk that the variable will be used without being initialized.
>>
>> This was largely found by using a static code analysis program called
>> cppcheck.
>>
>> Signed-off-by: Rickard Strandqvist<rickard_strandqvist@spectrumdigital.se>
>> ---
>> arch/tile/kernel/unaligned.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>
> Thanks! Taken into the tile tree with some slight modifications (initialize
> variables to -1 not 0, and remove the resulting dead code in find_regs).
>
> --
> Chris Metcalf, Tilera Corp.
> http://www.tilera.com
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-06-08 17:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-31 23:00 [PATCH] arch: tile: kernel: unaligned.c: Cleaning up uninitialized variables Rickard Strandqvist
2014-06-08 1:41 ` Chris Metcalf
2014-06-08 17:17 ` Rickard Strandqvist
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox