[PATCH-for-5.2 0/4] misc: Trivial format string fixes

Philippe Mathieu-Daudé posted 4 patches 3 years, 6 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20201103112558.2554390-1-philmd@redhat.com
Test checkpatch passed
hw/display/cirrus_vga.c | 20 +-------------------
migration/ram.c         |  2 +-
hw/ppc/trace-events     |  2 +-
3 files changed, 3 insertions(+), 21 deletions(-)
[PATCH-for-5.2 0/4] misc: Trivial format string fixes
Posted by Philippe Mathieu-Daudé 3 years, 6 months ago
IIUC qemu-trivial@ doesn't queue patches during freeze,
so it might be easier if patches are queued by respective
subsystem maintainers.

Philippe Mathieu-Daudé (4):
  hw/display/cirrus_vga: Remove debugging code commented out
  hw/display/cirrus_vga: Fix hexadecimal format string specifier
  hw/ppc/spapr_tpm_proxy: Fix hexadecimal format string specifier
  migration/ram: Fix hexadecimal format string specifier

 hw/display/cirrus_vga.c | 20 +-------------------
 migration/ram.c         |  2 +-
 hw/ppc/trace-events     |  2 +-
 3 files changed, 3 insertions(+), 21 deletions(-)

-- 
2.26.2


Re: [PATCH-for-5.2 0/4] misc: Trivial format string fixes
Posted by Dov Murik 3 years, 6 months ago
On 03/11/2020 13:25, Philippe Mathieu-Daudé wrote:
> IIUC qemu-trivial@ doesn't queue patches during freeze,
> 
> so it might be easier if patches are queued by respective
> 
> subsystem maintainers.
> 
> 
> 
> Philippe Mathieu-Daudé (4):
> 
>    hw/display/cirrus_vga: Remove debugging code commented out
> 
>    hw/display/cirrus_vga: Fix hexadecimal format string specifier
> 
>    hw/ppc/spapr_tpm_proxy: Fix hexadecimal format string specifier
> 
>    migration/ram: Fix hexadecimal format string specifier
> 
> 
> 
>   hw/display/cirrus_vga.c | 20 +-------------------
> 
>   migration/ram.c         |  2 +-
> 
>   hw/ppc/trace-events     |  2 +-
> 
>   3 files changed, 3 insertions(+), 21 deletions(-)
> 
> 
> 


There's at least one more easy fix:

hw/misc/trace-events:106:mos6522_get_next_irq_time(uint16_t latch, 
int64_t d, int64_t delta) "latch=%d counter=0x%"PRId64 " 
delta_next=0x%"PRId64

but I have no idea how to test this.

-Dov

Re: [PATCH-for-5.2 0/4] misc: Trivial format string fixes
Posted by Dov Murik 3 years, 6 months ago
On 03/11/2020 15:58, Dov Murik wrote:
> On 03/11/2020 13:25, Philippe Mathieu-Daudé wrote:
>> IIUC qemu-trivial@ doesn't queue patches during freeze,
>>
>> so it might be easier if patches are queued by respective
>>
>> subsystem maintainers.
>>
>>
>>
>> Philippe Mathieu-Daudé (4):
>>
>>    hw/display/cirrus_vga: Remove debugging code commented out
>>
>>    hw/display/cirrus_vga: Fix hexadecimal format string specifier
>>
>>    hw/ppc/spapr_tpm_proxy: Fix hexadecimal format string specifier
>>
>>    migration/ram: Fix hexadecimal format string specifier
>>
>>
>>
>>   hw/display/cirrus_vga.c | 20 +-------------------
>>
>>   migration/ram.c         |  2 +-
>>
>>   hw/ppc/trace-events     |  2 +-
>>
>>   3 files changed, 3 insertions(+), 21 deletions(-)
>>
>>
>>
> 
> 
> There's at least one more easy fix:
> 
> hw/misc/trace-events:106:mos6522_get_next_irq_time(uint16_t latch, 
> int64_t d, int64_t delta) "latch=%d counter=0x%"PRId64 " 
> delta_next=0x%"PRId64
> 
> but I have no idea how to test this.
> 
> -Dov
> 

... and one more in hw/usb/u2f-passthru.c:348 :

         error_report("%s: Bad written size (req 0x%zu, val 0x%zd)",
                      TYPE_U2F_PASSTHRU, sizeof(host_packet), written);


Again, I have no idea how to test/trigger these areas in the code.

-Dov


Re: [PATCH-for-5.2 0/4] misc: Trivial format string fixes
Posted by Philippe Mathieu-Daudé 3 years, 6 months ago
On 11/3/20 3:03 PM, Dov Murik wrote:
> 
> On 03/11/2020 15:58, Dov Murik wrote:
>> On 03/11/2020 13:25, Philippe Mathieu-Daudé wrote:
>>> IIUC qemu-trivial@ doesn't queue patches during freeze,
>>>
>>> so it might be easier if patches are queued by respective
>>>
>>> subsystem maintainers.
>>>
>>>
>>>
>>> Philippe Mathieu-Daudé (4):
>>>
>>>    hw/display/cirrus_vga: Remove debugging code commented out
>>>
>>>    hw/display/cirrus_vga: Fix hexadecimal format string specifier
>>>
>>>    hw/ppc/spapr_tpm_proxy: Fix hexadecimal format string specifier
>>>
>>>    migration/ram: Fix hexadecimal format string specifier
>>>
>>>
>>>
>>>   hw/display/cirrus_vga.c | 20 +-------------------
>>>
>>>   migration/ram.c         |  2 +-
>>>
>>>   hw/ppc/trace-events     |  2 +-
>>>
>>>   3 files changed, 3 insertions(+), 21 deletions(-)
>>>
>>>
>>>
>>
>>
>> There's at least one more easy fix:
>>
>> hw/misc/trace-events:106:mos6522_get_next_irq_time(uint16_t latch,
>> int64_t d, int64_t delta) "latch=%d counter=0x%"PRId64 "
>> delta_next=0x%"PRId64

Indeed.

>>
>> but I have no idea how to test this.
>>
>> -Dov
>>
> 
> ... and one more in hw/usb/u2f-passthru.c:348 :
> 
>         error_report("%s: Bad written size (req 0x%zu, val 0x%zd)",
>                      TYPE_U2F_PASSTHRU, sizeof(host_packet), written);

'written' is signed, so this format looks correct...

> 
> Again, I have no idea how to test/trigger these areas in the code.
> 
> -Dov
> 


Re: [PATCH-for-5.2 0/4] misc: Trivial format string fixes
Posted by Greg Kurz 3 years, 6 months ago
On Tue, 3 Nov 2020 15:28:11 +0100
Philippe Mathieu-Daudé <philmd@redhat.com> wrote:

> On 11/3/20 3:03 PM, Dov Murik wrote:
> > 
> > On 03/11/2020 15:58, Dov Murik wrote:
> >> On 03/11/2020 13:25, Philippe Mathieu-Daudé wrote:
> >>> IIUC qemu-trivial@ doesn't queue patches during freeze,
> >>>
> >>> so it might be easier if patches are queued by respective
> >>>
> >>> subsystem maintainers.
> >>>
> >>>
> >>>
> >>> Philippe Mathieu-Daudé (4):
> >>>
> >>>    hw/display/cirrus_vga: Remove debugging code commented out
> >>>
> >>>    hw/display/cirrus_vga: Fix hexadecimal format string specifier
> >>>
> >>>    hw/ppc/spapr_tpm_proxy: Fix hexadecimal format string specifier
> >>>
> >>>    migration/ram: Fix hexadecimal format string specifier
> >>>
> >>>
> >>>
> >>>   hw/display/cirrus_vga.c | 20 +-------------------
> >>>
> >>>   migration/ram.c         |  2 +-
> >>>
> >>>   hw/ppc/trace-events     |  2 +-
> >>>
> >>>   3 files changed, 3 insertions(+), 21 deletions(-)
> >>>
> >>>
> >>>
> >>
> >>
> >> There's at least one more easy fix:
> >>
> >> hw/misc/trace-events:106:mos6522_get_next_irq_time(uint16_t latch,
> >> int64_t d, int64_t delta) "latch=%d counter=0x%"PRId64 "
> >> delta_next=0x%"PRId64
> 
> Indeed.
> 
> >>
> >> but I have no idea how to test this.
> >>
> >> -Dov
> >>
> > 
> > ... and one more in hw/usb/u2f-passthru.c:348 :
> > 
> >         error_report("%s: Bad written size (req 0x%zu, val 0x%zd)",
> >                      TYPE_U2F_PASSTHRU, sizeof(host_packet), written);
> 
> 'written' is signed, so this format looks correct...
> 

Irrespective of the sign, u and d shouldn't be used behind 0x 

> > 
> > Again, I have no idea how to test/trigger these areas in the code.
> > 
> > -Dov
> > 
> 
> 


Re: [PATCH-for-5.2 0/4] misc: Trivial format string fixes
Posted by Philippe Mathieu-Daudé 3 years, 6 months ago
On 11/3/20 4:20 PM, Greg Kurz wrote:
> On Tue, 3 Nov 2020 15:28:11 +0100
> Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
> 
>> On 11/3/20 3:03 PM, Dov Murik wrote:
>>>
>>> On 03/11/2020 15:58, Dov Murik wrote:
>>>> On 03/11/2020 13:25, Philippe Mathieu-Daudé wrote:
>>>>> IIUC qemu-trivial@ doesn't queue patches during freeze,
>>>>>
>>>>> so it might be easier if patches are queued by respective
>>>>>
>>>>> subsystem maintainers.
>>>>>
>>>>>
>>>>>
>>>>> Philippe Mathieu-Daudé (4):
>>>>>
>>>>>    hw/display/cirrus_vga: Remove debugging code commented out
>>>>>
>>>>>    hw/display/cirrus_vga: Fix hexadecimal format string specifier
>>>>>
>>>>>    hw/ppc/spapr_tpm_proxy: Fix hexadecimal format string specifier
>>>>>
>>>>>    migration/ram: Fix hexadecimal format string specifier
>>>>>
>>>>>
>>>>>
>>>>>   hw/display/cirrus_vga.c | 20 +-------------------
>>>>>
>>>>>   migration/ram.c         |  2 +-
>>>>>
>>>>>   hw/ppc/trace-events     |  2 +-
>>>>>
>>>>>   3 files changed, 3 insertions(+), 21 deletions(-)
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> There's at least one more easy fix:
>>>>
>>>> hw/misc/trace-events:106:mos6522_get_next_irq_time(uint16_t latch,
>>>> int64_t d, int64_t delta) "latch=%d counter=0x%"PRId64 "
>>>> delta_next=0x%"PRId64
>>
>> Indeed.
>>
>>>>
>>>> but I have no idea how to test this.
>>>>
>>>> -Dov
>>>>
>>>
>>> ... and one more in hw/usb/u2f-passthru.c:348 :
>>>
>>>         error_report("%s: Bad written size (req 0x%zu, val 0x%zd)",
>>>                      TYPE_U2F_PASSTHRU, sizeof(host_packet), written);
>>
>> 'written' is signed, so this format looks correct...
>>
> 
> Irrespective of the sign, u and d shouldn't be used behind 0x 

Ah yes you are right =) Long day... So '0x%zx' in both cases.

> 
>>>
>>> Again, I have no idea how to test/trigger these areas in the code.
>>>
>>> -Dov
>>>
>>
>>
> 


Re: [PATCH-for-5.2 0/4] misc: Trivial format string fixes
Posted by Dov Murik 3 years, 6 months ago

On 03/11/2020 16:28, Philippe Mathieu-Daudé wrote:
> On 11/3/20 3:03 PM, Dov Murik wrote:
>>
>> On 03/11/2020 15:58, Dov Murik wrote:
>>> On 03/11/2020 13:25, Philippe Mathieu-Daudé wrote:
>>>> IIUC qemu-trivial@ doesn't queue patches during freeze,
>>>>
>>>> so it might be easier if patches are queued by respective
>>>>
>>>> subsystem maintainers.
>>>>
>>>>
>>>>
>>>> Philippe Mathieu-Daudé (4):
>>>>
>>>>     hw/display/cirrus_vga: Remove debugging code commented out
>>>>
>>>>     hw/display/cirrus_vga: Fix hexadecimal format string specifier
>>>>
>>>>     hw/ppc/spapr_tpm_proxy: Fix hexadecimal format string specifier
>>>>
>>>>     migration/ram: Fix hexadecimal format string specifier
>>>>
>>>>
>>>>
>>>>    hw/display/cirrus_vga.c | 20 +-------------------
>>>>
>>>>    migration/ram.c         |  2 +-
>>>>
>>>>    hw/ppc/trace-events     |  2 +-
>>>>
>>>>    3 files changed, 3 insertions(+), 21 deletions(-)
>>>>
>>>>
>>>>
>>>
>>>
>>> There's at least one more easy fix:
>>>
>>> hw/misc/trace-events:106:mos6522_get_next_irq_time(uint16_t latch,
>>> int64_t d, int64_t delta) "latch=%d counter=0x%"PRId64 "
>>> delta_next=0x%"PRId64
> 
> Indeed.
> 
>>>
>>> but I have no idea how to test this.
>>>
>>> -Dov
>>>
>>
>> ... and one more in hw/usb/u2f-passthru.c:348 :
>>
>>          error_report("%s: Bad written size (req 0x%zu, val 0x%zd)",
>>                       TYPE_U2F_PASSTHRU, sizeof(host_packet), written);
> 
> 'written' is signed, so this format looks correct...
> 

If we keep the %zu and %zd format specifiers, then I suggest removing 
the "0x" literal prefixes.


>>
>> Again, I have no idea how to test/trigger these areas in the code.
>>
>> -Dov
>>
> 
>