Re: [PATCH v2] target/ppc: Add lower bound check for watchdogNumber

Chinmay Rath <[email protected]>
Newsgroups org.nongnu.qemu-devel
Message-ID <[email protected]>
On 8/18/26 15:23, Amit Machhiwal wrote:
> On 2026/08/18 02:40 PM, Chinmay Rath wrote:
>> Add missing lower bound check for H_WATCHDOG H_CALL's watchdogNumber parameter
>> as per PAPR documentation ver 12.10.00 section 14.15.5 'H_WATCHDOG'.
>>
>> Closes : https://gitlab.com/qemu-project/qemu/-/work_items/3600
>> Signed-off-by: Chinmay Rath <[email protected]>
>> ---
>>
>> Changes from v1 : Incorporated changes suggested by Amit.
> Thanks for the quick v2 — the helper and the OP_STOP restructuring look
> good. One remaining nit below.
>
>> v1 : https://lore.kernel.org/qemu-devel/[email protected]/
>>
>>   hw/watchdog/spapr_watchdog.c | 16 +++++++++++-----
>>   1 file changed, 11 insertions(+), 5 deletions(-)
>>
>> diff --git a/hw/watchdog/spapr_watchdog.c b/hw/watchdog/spapr_watchdog.c
>> index 5b3f50de3a..460b4457a6 100644
>> --- a/hw/watchdog/spapr_watchdog.c
>> +++ b/hw/watchdog/spapr_watchdog.c
>> @@ -127,6 +127,12 @@ static void watchdog_expired(void *pw)
>>       }
>>   }
>>   
>> +static inline bool watchdogNumber_valid(target_ulong watchdogNumber,
> The function name watchdogNumber_valid mixes camelCase with snake_case.
> Per the QEMU coding style (docs/devel/style.rst), CamelCase is reserved
> for structured type names and typedefs — regular function names follow
> lower_case_with_underscores. This should be watchdog_number_valid.
Hey thanks for letting me know. I have posted the correct patch 
retaining your R-by.
I had gone ahead with this naming cause the variable itself was named 
'watchdogNumber'.
But going though the qemu coding style, since watchdogNumber is not a 
'structured' type, I guess it should have been named in snake case and 
not camel case in the first place.

Regards,
Chinmay
>
> With that fixed:
>
> Reviewed-by: Amit Machhiwal <[email protected]>
>
> Thanks,
> Amit
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.