All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sparc: fix array bounds error setting up PCIC NMI trap
@ 2011-08-18  8:14 Ian Campbell
  2011-08-18  8:59 ` David Miller
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Ian Campbell @ 2011-08-18  8:14 UTC (permalink / raw)
  To: sparclinux

From a sparc64 defconfig:
  CC      arch/sparc/kernel/pcic.o
arch/sparc/kernel/pcic.c: In function 'pcic_probe':
arch/sparc/kernel/pcic.c:359:33: error: array subscript is above array bounds [-Werror=array-bounds]
arch/sparc/kernel/pcic.c:359:8: error: array subscript is above array bounds [-Werror=array-bounds]
arch/sparc/kernel/pcic.c:360:33: error: array subscript is above array bounds [-Werror=array-bounds]
arch/sparc/kernel/pcic.c:360:8: error: array subscript is above array bounds [-Werror=array-bounds]
arch/sparc/kernel/pcic.c:361:33: error: array subscript is above array bounds [-Werror=array-bounds]
arch/sparc/kernel/pcic.c:361:8: error: array subscript is above array bounds [-Werror=array-bounds]
cc1: all warnings being treated as errors

I'm not particularly familiar with sparc but t_nmi (defined in head_32.S via
the TRAP_ENTRY macro) and pcic_nmi_trap_patch (defined in entry.S) both appear
to be 4 instructions long and I presume from the usage that instructions are
int sized.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: sparclinux@vger.kernel.org
---
 arch/sparc/kernel/pcic.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index a19f041..1aaf8c1 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -352,8 +352,8 @@ int __init pcic_probe(void)
 	strcpy(pbm->prom_name, namebuf);
 
 	{
-		extern volatile int t_nmi[1];
-		extern int pcic_nmi_trap_patch[1];
+		extern volatile int t_nmi[4];
+		extern int pcic_nmi_trap_patch[4];
 
 		t_nmi[0] = pcic_nmi_trap_patch[0];
 		t_nmi[1] = pcic_nmi_trap_patch[1];
-- 
1.7.2.5


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

* Re: [PATCH] sparc: fix array bounds error setting up PCIC NMI trap
  2011-08-18  8:14 [PATCH] sparc: fix array bounds error setting up PCIC NMI trap Ian Campbell
@ 2011-08-18  8:59 ` David Miller
  2011-08-18  9:25 ` Ian Campbell
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2011-08-18  8:59 UTC (permalink / raw)
  To: sparclinux

From: Ian Campbell <ian.campbell@citrix.com>
Date: Thu, 18 Aug 2011 09:14:57 +0100

>>From a sparc64 defconfig:
>   CC      arch/sparc/kernel/pcic.o

A sparc64 defconfig?  This is code only built for 32-bit sparc :-)

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

* Re: [PATCH] sparc: fix array bounds error setting up PCIC NMI trap
  2011-08-18  8:14 [PATCH] sparc: fix array bounds error setting up PCIC NMI trap Ian Campbell
  2011-08-18  8:59 ` David Miller
@ 2011-08-18  9:25 ` Ian Campbell
  2011-08-18  9:49 ` Sam Ravnborg
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Ian Campbell @ 2011-08-18  9:25 UTC (permalink / raw)
  To: sparclinux

On Thu, 2011-08-18 at 09:59 +0100, David Miller wrote:
> From: Ian Campbell <ian.campbell@citrix.com>
> Date: Thu, 18 Aug 2011 09:14:57 +0100
> 
> >>From a sparc64 defconfig:
> >   CC      arch/sparc/kernel/pcic.o
> 
> A sparc64 defconfig?  This is code only built for 32-bit sparc :-)

My local script confused me, it translated sparc64 into ARCH=sparc for
me, where it turns out the defconfig = sparc32_defconfig, so I was
actually building 32 bit. Sorry about that.

Turns out I also saw this on 32-bit sparc defconfig, which is hardly
surprising given the two .configs are exactly the same ;-)

Ian.


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

* Re: [PATCH] sparc: fix array bounds error setting up PCIC NMI trap
  2011-08-18  8:14 [PATCH] sparc: fix array bounds error setting up PCIC NMI trap Ian Campbell
  2011-08-18  8:59 ` David Miller
  2011-08-18  9:25 ` Ian Campbell
@ 2011-08-18  9:49 ` Sam Ravnborg
  2011-08-18 10:05 ` Ian Campbell
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Sam Ravnborg @ 2011-08-18  9:49 UTC (permalink / raw)
  To: sparclinux

On Thu, Aug 18, 2011 at 10:25:15AM +0100, Ian Campbell wrote:
> On Thu, 2011-08-18 at 09:59 +0100, David Miller wrote:
> > From: Ian Campbell <ian.campbell@citrix.com>
> > Date: Thu, 18 Aug 2011 09:14:57 +0100
> > 
> > >>From a sparc64 defconfig:
> > >   CC      arch/sparc/kernel/pcic.o
> > 
> > A sparc64 defconfig?  This is code only built for 32-bit sparc :-)
> 
> My local script confused me, it translated sparc64 into ARCH=sparc for
> me, where it turns out the defconfig = sparc32_defconfig, so I was
> actually building 32 bit. Sorry about that.
> 
> Turns out I also saw this on 32-bit sparc defconfig, which is hardly
> surprising given the two .configs are exactly the same ;-)
sparse complains too - I just never got around to fix it up.

If you do nto beat me I will look at it soon.

	Sam

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

* Re: [PATCH] sparc: fix array bounds error setting up PCIC NMI trap
  2011-08-18  8:14 [PATCH] sparc: fix array bounds error setting up PCIC NMI trap Ian Campbell
                   ` (2 preceding siblings ...)
  2011-08-18  9:49 ` Sam Ravnborg
@ 2011-08-18 10:05 ` Ian Campbell
  2011-08-18 19:06 ` Sam Ravnborg
  2011-08-19  4:49 ` David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: Ian Campbell @ 2011-08-18 10:05 UTC (permalink / raw)
  To: sparclinux

On Thu, 2011-08-18 at 10:49 +0100, Sam Ravnborg wrote:
> On Thu, Aug 18, 2011 at 10:25:15AM +0100, Ian Campbell wrote:
> > On Thu, 2011-08-18 at 09:59 +0100, David Miller wrote:
> > > From: Ian Campbell <ian.campbell@citrix.com>
> > > Date: Thu, 18 Aug 2011 09:14:57 +0100
> > > 
> > > >>From a sparc64 defconfig:
> > > >   CC      arch/sparc/kernel/pcic.o
> > > 
> > > A sparc64 defconfig?  This is code only built for 32-bit sparc :-)
> > 
> > My local script confused me, it translated sparc64 into ARCH=sparc for
> > me, where it turns out the defconfig = sparc32_defconfig, so I was
> > actually building 32 bit. Sorry about that.
> > 
> > Turns out I also saw this on 32-bit sparc defconfig, which is hardly
> > surprising given the two .configs are exactly the same ;-)
> sparse complains too - I just never got around to fix it up.
> 
> If you do nto beat me I will look at it soon.

With my patch applied I don't see any sparse warnings for these lines of
pcic.c, although there are others:
  CHECK   /local/scratch/ianc/devel/kernels/linux-2.6/arch/sparc/kernel/pcic.c
arch/sparc/kernel/pcic.c:163:14: warning: symbol 'pcic_regs' was not declared. Should it be static?
arch/sparc/kernel/pcic.c:164:14: warning: symbol 'pcic_speculative' was not declared. Should it be static?
arch/sparc/kernel/pcic.c:165:14: warning: symbol 'pcic_trapped' was not declared. Should it be static?
arch/sparc/kernel/pcic.c:331:66: warning: Using plain integer as NULL pointer
arch/sparc/kernel/pcic.c:343:66: warning: Using plain integer as NULL pointer
arch/sparc/kernel/pcic.c:539:38: warning: Using plain integer as NULL pointer
arch/sparc/kernel/pcic.c:677:1: warning: symbol 'pcic_pin_to_irq' was not declared. Should it be static?
arch/sparc/kernel/pcic.c:718:5: warning: symbol 'pci_gettimeoffset' was not declared. Should it be static?
arch/sparc/kernel/pcic.c:787:6: warning: symbol 'pcic_nmi' was not declared. Should it be static?
arch/sparc/kernel/pcic.c:883:5: warning: symbol 'pcibios_assign_resource' was not declared. Should it be static?
  CC      arch/sparc/kernel/pcic.o

Ian.


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

* Re: [PATCH] sparc: fix array bounds error setting up PCIC NMI trap
  2011-08-18  8:14 [PATCH] sparc: fix array bounds error setting up PCIC NMI trap Ian Campbell
                   ` (3 preceding siblings ...)
  2011-08-18 10:05 ` Ian Campbell
@ 2011-08-18 19:06 ` Sam Ravnborg
  2011-08-19  4:49 ` David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: Sam Ravnborg @ 2011-08-18 19:06 UTC (permalink / raw)
  To: sparclinux

Hi Ian.

On Thu, Aug 18, 2011 at 11:05:48AM +0100, Ian Campbell wrote:
> On Thu, 2011-08-18 at 10:49 +0100, Sam Ravnborg wrote:
> > On Thu, Aug 18, 2011 at 10:25:15AM +0100, Ian Campbell wrote:
> > > On Thu, 2011-08-18 at 09:59 +0100, David Miller wrote:
> > > > From: Ian Campbell <ian.campbell@citrix.com>
> > > > Date: Thu, 18 Aug 2011 09:14:57 +0100
> > > > 
> > > > >>From a sparc64 defconfig:
> > > > >   CC      arch/sparc/kernel/pcic.o
> > > > 
> > > > A sparc64 defconfig?  This is code only built for 32-bit sparc :-)
> > > 
> > > My local script confused me, it translated sparc64 into ARCH=sparc for
> > > me, where it turns out the defconfig = sparc32_defconfig, so I was
> > > actually building 32 bit. Sorry about that.
> > > 
> > > Turns out I also saw this on 32-bit sparc defconfig, which is hardly
> > > surprising given the two .configs are exactly the same ;-)
> > sparse complains too - I just never got around to fix it up.
> > 
> > If you do nto beat me I will look at it soon.

Somehow I missed that you already had provided a patch in the first mail.
this patch has my:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

> 
> With my patch applied I don't see any sparse warnings for these lines of
> pcic.c, although there are others:
>   CHECK   /local/scratch/ianc/devel/kernels/linux-2.6/arch/sparc/kernel/pcic.c
> arch/sparc/kernel/pcic.c:163:14: warning: symbol 'pcic_regs' was not declared. Should it be static?
> arch/sparc/kernel/pcic.c:164:14: warning: symbol 'pcic_speculative' was not declared. Should it be static?
> arch/sparc/kernel/pcic.c:165:14: warning: symbol 'pcic_trapped' was not declared. Should it be static?
> arch/sparc/kernel/pcic.c:331:66: warning: Using plain integer as NULL pointer
> arch/sparc/kernel/pcic.c:343:66: warning: Using plain integer as NULL pointer
> arch/sparc/kernel/pcic.c:539:38: warning: Using plain integer as NULL pointer
> arch/sparc/kernel/pcic.c:677:1: warning: symbol 'pcic_pin_to_irq' was not declared. Should it be static?
> arch/sparc/kernel/pcic.c:718:5: warning: symbol 'pci_gettimeoffset' was not declared. Should it be static?
> arch/sparc/kernel/pcic.c:787:6: warning: symbol 'pcic_nmi' was not declared. Should it be static?
> arch/sparc/kernel/pcic.c:883:5: warning: symbol 'pcibios_assign_resource' was not declared. Should it be static?
>   CC      arch/sparc/kernel/pcic.oA

Trivial stuff - mostly missing extern stuff.
But we should kill these warnings soon so they do not hide more serious warnings.

	Sam

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

* Re: [PATCH] sparc: fix array bounds error setting up PCIC NMI trap
  2011-08-18  8:14 [PATCH] sparc: fix array bounds error setting up PCIC NMI trap Ian Campbell
                   ` (4 preceding siblings ...)
  2011-08-18 19:06 ` Sam Ravnborg
@ 2011-08-19  4:49 ` David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2011-08-19  4:49 UTC (permalink / raw)
  To: sparclinux

From: Sam Ravnborg <sam@ravnborg.org>
Date: Thu, 18 Aug 2011 21:06:26 +0200

> Hi Ian.
> 
> On Thu, Aug 18, 2011 at 11:05:48AM +0100, Ian Campbell wrote:
>> On Thu, 2011-08-18 at 10:49 +0100, Sam Ravnborg wrote:
>> > On Thu, Aug 18, 2011 at 10:25:15AM +0100, Ian Campbell wrote:
>> > > On Thu, 2011-08-18 at 09:59 +0100, David Miller wrote:
>> > > > From: Ian Campbell <ian.campbell@citrix.com>
>> > > > Date: Thu, 18 Aug 2011 09:14:57 +0100
>> > > > 
>> > > > >>From a sparc64 defconfig:
>> > > > >   CC      arch/sparc/kernel/pcic.o
>> > > > 
>> > > > A sparc64 defconfig?  This is code only built for 32-bit sparc :-)
>> > > 
>> > > My local script confused me, it translated sparc64 into ARCH=sparc for
>> > > me, where it turns out the defconfig = sparc32_defconfig, so I was
>> > > actually building 32 bit. Sorry about that.
>> > > 
>> > > Turns out I also saw this on 32-bit sparc defconfig, which is hardly
>> > > surprising given the two .configs are exactly the same ;-)
>> > sparse complains too - I just never got around to fix it up.
>> > 
>> > If you do nto beat me I will look at it soon.
> 
> Somehow I missed that you already had provided a patch in the first mail.
> this patch has my:
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

Applied, thanks everyone.

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

end of thread, other threads:[~2011-08-19  4:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-18  8:14 [PATCH] sparc: fix array bounds error setting up PCIC NMI trap Ian Campbell
2011-08-18  8:59 ` David Miller
2011-08-18  9:25 ` Ian Campbell
2011-08-18  9:49 ` Sam Ravnborg
2011-08-18 10:05 ` Ian Campbell
2011-08-18 19:06 ` Sam Ravnborg
2011-08-19  4:49 ` David Miller

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.