mbox series

[v3,0/5] Fix LoongArch coverity error and cpu name bug

Message ID 20220715060740.1500628-1-yangxiaojuan@loongson.cn (mailing list archive)
Headers show
Series Fix LoongArch coverity error and cpu name bug | expand

Message

Xiaojuan Yang July 15, 2022, 6:07 a.m. UTC
This series fix some coverity errors and loongarch_cpu_class_by_name function
for LoongArch virt machine.

Only the loongarch_pch_pic patch(number 2/5) need to be reviewed in this v3
verison, and other patches have been reviewed.

Changes for v3:

1. In loongarch_pch_pic file, We should not use 'unsigned long'
   type as argument when we use find_first_bit(), and we use
   ctz64() to replace find_first_bit() to fix this bug.
2. It is not standard to use '1ULL << irq' to generate a irq mask.
   So, we replace it with 'MAKE_64BIT_MASK(irq, 1)'.
3. Rewrite commit comments for op_helper patch(number 5/5).

Changes for v2:

1. Use MAKE_64BIT_MASK(shift, len) to replace 'xxx << shift'.
2. Use ARRAY_SIZE(arrqy) to get the array size.
3. Add the assertion that 'cpu_model' resolve to a class of the 
   appropriate type.


Changes for v1:

1. Fix coverity errors such as out-of-bounds, integer overflow,
   cond_at_most, etc.
2. Fix loongarch_cpu_class_by_name function.


Please help review
Thanks.

Xiaojuan Yang (5):
  target/loongarch/cpu: Fix cpu_class_by_name function
  hw/intc/loongarch_pch_pic: Fix bugs for update_irq function
  target/loongarch/cpu: Fix coverity errors about excp_names
  target/loongarch/tlb_helper: Fix coverity integer overflow error
  target/loongarch/op_helper: Fix coverity cond_at_most error

 hw/intc/loongarch_pch_pic.c   | 18 +++++++++++-------
 target/loongarch/cpu.c        | 15 ++++++++-------
 target/loongarch/op_helper.c  |  2 +-
 target/loongarch/tlb_helper.c |  4 ++--
 4 files changed, 22 insertions(+), 17 deletions(-)

Comments

Richard Henderson July 19, 2022, 6:58 a.m. UTC | #1
On 7/15/22 11:37, Xiaojuan Yang wrote:
> This series fix some coverity errors and loongarch_cpu_class_by_name function
> for LoongArch virt machine.
> 
> Only the loongarch_pch_pic patch(number 2/5) need to be reviewed in this v3
> verison, and other patches have been reviewed.
> 
> Changes for v3:
> 
> 1. In loongarch_pch_pic file, We should not use 'unsigned long'
>     type as argument when we use find_first_bit(), and we use
>     ctz64() to replace find_first_bit() to fix this bug.
> 2. It is not standard to use '1ULL << irq' to generate a irq mask.
>     So, we replace it with 'MAKE_64BIT_MASK(irq, 1)'.
> 3. Rewrite commit comments for op_helper patch(number 5/5).

Queued all of these, with fixes as described for patches 1 and 2.


r~

> 
> Changes for v2:
> 
> 1. Use MAKE_64BIT_MASK(shift, len) to replace 'xxx << shift'.
> 2. Use ARRAY_SIZE(arrqy) to get the array size.
> 3. Add the assertion that 'cpu_model' resolve to a class of the
>     appropriate type.
> 
> 
> Changes for v1:
> 
> 1. Fix coverity errors such as out-of-bounds, integer overflow,
>     cond_at_most, etc.
> 2. Fix loongarch_cpu_class_by_name function.
> 
> 
> Please help review
> Thanks.
> 
> Xiaojuan Yang (5):
>    target/loongarch/cpu: Fix cpu_class_by_name function
>    hw/intc/loongarch_pch_pic: Fix bugs for update_irq function
>    target/loongarch/cpu: Fix coverity errors about excp_names
>    target/loongarch/tlb_helper: Fix coverity integer overflow error
>    target/loongarch/op_helper: Fix coverity cond_at_most error
> 
>   hw/intc/loongarch_pch_pic.c   | 18 +++++++++++-------
>   target/loongarch/cpu.c        | 15 ++++++++-------
>   target/loongarch/op_helper.c  |  2 +-
>   target/loongarch/tlb_helper.c |  4 ++--
>   4 files changed, 22 insertions(+), 17 deletions(-)
>