From: Sven Schnelle <svens@stackframe.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: deller@kernel.org, qemu-devel@nongnu.org,
Soumyajyotii Ssarkar <soumyajyotisarkar23@gmail.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Helge Deller <deller@gmx.de>,
Richard Henderson <richard.henderson@linaro.org>,
Fam Zheng <fam@euphon.net>
Subject: Re: [PULL 12/12] target/hppa: add 64 bit support to gdbstub
Date: Tue, 10 Mar 2026 17:49:27 +0100 [thread overview]
Message-ID: <873427bpew.fsf@stackframe.org> (raw)
In-Reply-To: <518117ad-777a-4bce-ab9e-cdfaf360d81d@linaro.org>
Philippe Mathieu-Daudé <philmd@linaro.org> writes:
> Hi Sven!
>
> On 10/3/26 08:06, Sven Schnelle wrote:
>> Sven Schnelle <svens@stackframe.org> writes:
>>
>>> Philippe Mathieu-Daudé <philmd@linaro.org> writes:
>>>
>>>> Hi,
>>>>
>>>> (now merged as commit b2c2d00f48cc5f4486cfba33b505ff86d79cb137)
>>>>
>>>> On 23/12/25 16:50, deller@kernel.org wrote:
>>>>> From: Sven Schnelle <svens@stackframe.org>
>>>>> Signed-off-by: Sven Schnelle <svens@stackframe.org>
>>>>> Reviewed-by: Helge Deller <deller@gmx.de>
>>>>> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>>>>> Signed-off-by: Helge Deller <deller@gmx.de>
>>>>> ---
>>>>> target/hppa/gdbstub.c | 62
>>>> ++++++++++++++++++++++++++++---------------
>>>>> 1 file changed, 41 insertions(+), 21 deletions(-)
>>>>> diff --git a/target/hppa/gdbstub.c b/target/hppa/gdbstub.c
>>>>> index 0daa52f7af..777f4a48b9 100644
>>>>> --- a/target/hppa/gdbstub.c
>>>>> +++ b/target/hppa/gdbstub.c
>>>>> @@ -21,16 +21,25 @@
>>>>> @@ -133,24 +142,35 @@ int hppa_cpu_gdb_read_register(CPUState *cs,
>>>> GByteArray *mem_buf, int n)
>>>>> val = env->cr[30];
>>>>> break;
>>>>> case 64 ... 127:
>>>>> - val = extract64(env->fr[(n - 64) / 2], (n & 1 ? 0 : 32), 32);
>>>>> - break;
>>>>> - default:
>>>>> - if (n < 128) {
>>>>> - val = 0;
>>>>> + if (hppa_is_pa20(env)) {
>>>>> + val = env->fr[n - 64];
>>>>
>>>> Coverity reports:
>>>>
>>>>>>> CID 1645613: Memory - illegal accesses (OVERRUN)
>>>>>>> Overrunning array "env->fr" of 32 8-byte elements at element
>>>> index 32 (byte offset 263) using index "n - 64" (which
>>>> evaluates to 32).
>>>
>>> Yes, there's indeed a check missing wether n is < 96. I'll submit a patch later.
>> Looking again there is
>> if (n >= hppa_num_regs(env)) {
>> return 0;
>> }
>> right at the beginning of both functions, which returns 96 for 64
>> bit
>> mode as the limit so n should have proper bounds already if I'm not mistaken.
>
> I thought the same but wasn't sure. Maybe adding a pair of assert()
> are sufficient to fell safe and make Coverity happy?
Feel free to do so, but I don't want to write code just to make some
code checker happy.
next prev parent reply other threads:[~2026-03-10 16:50 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-23 15:50 [PULL 00/12] Hppa updates qemu v11 patches deller
2025-12-23 15:50 ` [PULL 02/12] scsi: ncr710: Add null pointer checks deller
2025-12-23 15:50 ` [PULL 03/12] scsi: ncr710: Fix use after free in command_complete deller
2025-12-23 15:50 ` [PULL 04/12] scsi: ncr710: Fix interrupt related register handing deller
2025-12-23 15:50 ` [PULL 05/12] scsi: ncr710: Fix DMA State machine and flow control deller
2025-12-23 15:50 ` [PULL 06/12] scsi: ncr710: Fix table indirect addressing endianness deller
2025-12-23 15:50 ` [PULL 07/12] scsi: ncr710: Mark command complete in status phase and fix disconnect deller
2025-12-23 15:50 ` [PULL 08/12] scsi: ncr710: Add LUN scanning deller
2025-12-23 15:50 ` [PULL 09/12] scsi: ncr710: Simplify disconnect handling deller
2025-12-23 15:50 ` [PULL 10/12] scsi: ncr710: Fix DSA register deller
2025-12-23 15:50 ` [PULL 11/12] scsi: ncr710: Fix CTEST FIFO status deller
2025-12-23 15:50 ` [PULL 12/12] target/hppa: add 64 bit support to gdbstub deller
2026-03-10 6:15 ` Philippe Mathieu-Daudé
2026-03-10 6:45 ` Sven Schnelle
2026-03-10 7:06 ` Sven Schnelle
2026-03-10 10:54 ` Philippe Mathieu-Daudé
2026-03-10 16:49 ` Sven Schnelle [this message]
2025-12-28 22:08 ` [PULL 00/12] Hppa updates qemu v11 patches Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=873427bpew.fsf@stackframe.org \
--to=svens@stackframe.org \
--cc=deller@gmx.de \
--cc=deller@kernel.org \
--cc=fam@euphon.net \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=soumyajyotisarkar23@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox