Alexander Duyck <alexander.du...@gmail.com> writes:

On Fri, Dec 4, 2020 at 4:15 AM <akiy...@amazon.com> wrote:

From: Arthur Kiyanovski <akiy...@amazon.com>

This patch adds explicit casting to some implicit conversions in the ena driver. The implicit conversions fail some of our static checkers that
search for accidental conversions in our driver.
Adding this cast won't affect the end results, and would sooth the
checkers.

Signed-off-by: Ido Segev <id...@amazon.com>
Signed-off-by: Igor Chauskin <igo...@amazon.com>
Signed-off-by: Shay Agroskin <shay...@amazon.com>
Signed-off-by: Arthur Kiyanovski <akiy...@amazon.com>
---
...
@@ -2712,7 +2712,7 @@ int ena_com_indirect_table_get(struct ena_com_dev *ena_dev, u32 *ind_tbl)
        u32 tbl_size;
        int i, rc;

-       tbl_size = (1ULL << rss->tbl_log_size) *
+       tbl_size = (u32)(1ULL << rss->tbl_log_size) *
                sizeof(struct ena_admin_rss_ind_table_entry);

        rc = ena_com_get_feature_ex(ena_dev, &get_resp,

For these last two why not make it 1u instead of 1ull for the bit
being shifted? At least that way you are not implying possible
truncation in the conversion.

We decided to remove this conversion from the patch altogether. We might do something different in the future to achieve the same result. Thanks for your comment

Reply via email to