* [Qemu-devel] [PATCH] linux-user: avoid gcc array overrun warning for sparc
@ 2011-02-01 15:54 Peter Maydell
2011-02-01 16:00 ` Peter Maydell
2011-02-01 17:58 ` [Qemu-devel] " Blue Swirl
0 siblings, 2 replies; 4+ messages in thread
From: Peter Maydell @ 2011-02-01 15:54 UTC (permalink / raw)
To: qemu-devel; +Cc: Blue Swirl, Riku Voipio, patches
Suppress a gcc array bounds overrun warning when filling in the SPARC
signal frame by adjusting our definition of the structure so that the
fp and callers_pc membes are part of the ins[] array rather than
separate fields; since qemu has no need to access the fields individually
there is no need to follow the kernel's structure field naming exactly.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
This is a fix for another warning that the armel gcc gives:
linux-user/signal.c:1979: error: array subscript is above array bounds
so if it passes review I think it's a good candidate for putting in 0.14.
linux-user/signal.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/linux-user/signal.c b/linux-user/signal.c
index 0664770..b01bd64 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -1817,9 +1817,10 @@ struct target_sigcontext {
/* A Sparc stack frame */
struct sparc_stackf {
abi_ulong locals[8];
- abi_ulong ins[6];
- struct sparc_stackf *fp;
- abi_ulong callers_pc;
+ abi_ulong ins[8];
+ /* It's simpler to treat fp and callers_pc as elements of ins[]
+ * since we never need to access them ourselves.
+ */
char *structptr;
abi_ulong xargs[6];
abi_ulong xxargs[1];
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] linux-user: avoid gcc array overrun warning for sparc
2011-02-01 15:54 [Qemu-devel] [PATCH] linux-user: avoid gcc array overrun warning for sparc Peter Maydell
@ 2011-02-01 16:00 ` Peter Maydell
2011-02-01 18:02 ` Blue Swirl
2011-02-01 17:58 ` [Qemu-devel] " Blue Swirl
1 sibling, 1 reply; 4+ messages in thread
From: Peter Maydell @ 2011-02-01 16:00 UTC (permalink / raw)
To: qemu-devel; +Cc: Blue Swirl, Riku Voipio, patches
On 1 February 2011 15:54, Peter Maydell <peter.maydell@linaro.org> wrote:
> --- a/linux-user/signal.c
> +++ b/linux-user/signal.c
> @@ -1817,9 +1817,10 @@ struct target_sigcontext {
> /* A Sparc stack frame */
> struct sparc_stackf {
> abi_ulong locals[8];
> - abi_ulong ins[6];
> - struct sparc_stackf *fp;
> - abi_ulong callers_pc;
> + abi_ulong ins[8];
> + /* It's simpler to treat fp and callers_pc as elements of ins[]
> + * since we never need to access them ourselves.
> + */
> char *structptr;
Incidentally, I think the presence of a host pointer in a target
structure definition is a (different) bug which might cause problems
when the target and host have different pointer sizes...
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Qemu-devel] Re: [PATCH] linux-user: avoid gcc array overrun warning for sparc
2011-02-01 15:54 [Qemu-devel] [PATCH] linux-user: avoid gcc array overrun warning for sparc Peter Maydell
2011-02-01 16:00 ` Peter Maydell
@ 2011-02-01 17:58 ` Blue Swirl
1 sibling, 0 replies; 4+ messages in thread
From: Blue Swirl @ 2011-02-01 17:58 UTC (permalink / raw)
To: Peter Maydell; +Cc: Riku Voipio, qemu-devel, patches
Thanks, applied.
On Tue, Feb 1, 2011 at 3:54 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> Suppress a gcc array bounds overrun warning when filling in the SPARC
> signal frame by adjusting our definition of the structure so that the
> fp and callers_pc membes are part of the ins[] array rather than
> separate fields; since qemu has no need to access the fields individually
> there is no need to follow the kernel's structure field naming exactly.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> This is a fix for another warning that the armel gcc gives:
> linux-user/signal.c:1979: error: array subscript is above array bounds
> so if it passes review I think it's a good candidate for putting in 0.14.
>
> linux-user/signal.c | 7 ++++---
> 1 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/linux-user/signal.c b/linux-user/signal.c
> index 0664770..b01bd64 100644
> --- a/linux-user/signal.c
> +++ b/linux-user/signal.c
> @@ -1817,9 +1817,10 @@ struct target_sigcontext {
> /* A Sparc stack frame */
> struct sparc_stackf {
> abi_ulong locals[8];
> - abi_ulong ins[6];
> - struct sparc_stackf *fp;
> - abi_ulong callers_pc;
> + abi_ulong ins[8];
> + /* It's simpler to treat fp and callers_pc as elements of ins[]
> + * since we never need to access them ourselves.
> + */
> char *structptr;
> abi_ulong xargs[6];
> abi_ulong xxargs[1];
> --
> 1.7.1
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] linux-user: avoid gcc array overrun warning for sparc
2011-02-01 16:00 ` Peter Maydell
@ 2011-02-01 18:02 ` Blue Swirl
0 siblings, 0 replies; 4+ messages in thread
From: Blue Swirl @ 2011-02-01 18:02 UTC (permalink / raw)
To: Peter Maydell; +Cc: Riku Voipio, qemu-devel, patches
On Tue, Feb 1, 2011 at 4:00 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 1 February 2011 15:54, Peter Maydell <peter.maydell@linaro.org> wrote:
>> --- a/linux-user/signal.c
>> +++ b/linux-user/signal.c
>> @@ -1817,9 +1817,10 @@ struct target_sigcontext {
>> /* A Sparc stack frame */
>> struct sparc_stackf {
>> abi_ulong locals[8];
>> - abi_ulong ins[6];
>> - struct sparc_stackf *fp;
>> - abi_ulong callers_pc;
>> + abi_ulong ins[8];
>> + /* It's simpler to treat fp and callers_pc as elements of ins[]
>> + * since we never need to access them ourselves.
>> + */
>> char *structptr;
>
> Incidentally, I think the presence of a host pointer in a target
> structure definition is a (different) bug which might cause problems
> when the target and host have different pointer sizes...
Right, it was copied from Linux. I can't see where it was used.
UREG_FP use cases look OK.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-02-01 18:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-01 15:54 [Qemu-devel] [PATCH] linux-user: avoid gcc array overrun warning for sparc Peter Maydell
2011-02-01 16:00 ` Peter Maydell
2011-02-01 18:02 ` Blue Swirl
2011-02-01 17:58 ` [Qemu-devel] " Blue Swirl
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.