Powered by Linux
Questions about the checker replacing divide condition with a compare condition — Semantic Matching Tool

Questions about the checker replacing divide condition with a compare condition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dan,

I have some questions about one checker result [1]:

drivers/scsi/huawei/hifc/unf_exchg.c:484 unf_get_xchg_config_sum()
warn: replace divide condition '*v_xchg_sum / (4)' with '*v_xchg_sum
>= (4)'

1. What's the rule of this checker?
If the code compares the quotient with zero, let's change it to a
compare operation? This is kind of optimization?
2. Why does the suggestion change it to ">="?
>From my understanding, it should use "<".

[1] https://gitee.com/openeuler/kernel/blob/openEuler-22.03-LTS-SP1/drivers/scsi/huawei/hifc/unf_exchg.c#L484

--
My best regards to you.

     No System Is Safe!
     Dongliang Mu



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux