mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
habanalabs: cast to u64 before shift > 31 bits
[ Upstream commit f763946aef ]
When shifting a boolean variable by more than 31 bits and putting the
result into a u64 variable, we need to cast the boolean into unsigned 64
bits to prevent possible overflow.
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
411df177e5
commit
eb46fbcde2
@@ -6099,7 +6099,7 @@ static bool gaudi_is_device_idle(struct hl_device *hdev, u32 *mask,
|
|||||||
is_idle &= is_eng_idle;
|
is_idle &= is_eng_idle;
|
||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
*mask |= !is_eng_idle <<
|
*mask |= ((u64) !is_eng_idle) <<
|
||||||
(GAUDI_ENGINE_ID_DMA_0 + dma_id);
|
(GAUDI_ENGINE_ID_DMA_0 + dma_id);
|
||||||
if (s)
|
if (s)
|
||||||
seq_printf(s, fmt, dma_id,
|
seq_printf(s, fmt, dma_id,
|
||||||
@@ -6122,7 +6122,8 @@ static bool gaudi_is_device_idle(struct hl_device *hdev, u32 *mask,
|
|||||||
is_idle &= is_eng_idle;
|
is_idle &= is_eng_idle;
|
||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
*mask |= !is_eng_idle << (GAUDI_ENGINE_ID_TPC_0 + i);
|
*mask |= ((u64) !is_eng_idle) <<
|
||||||
|
(GAUDI_ENGINE_ID_TPC_0 + i);
|
||||||
if (s)
|
if (s)
|
||||||
seq_printf(s, fmt, i,
|
seq_printf(s, fmt, i,
|
||||||
is_eng_idle ? "Y" : "N",
|
is_eng_idle ? "Y" : "N",
|
||||||
@@ -6150,7 +6151,8 @@ static bool gaudi_is_device_idle(struct hl_device *hdev, u32 *mask,
|
|||||||
is_idle &= is_eng_idle;
|
is_idle &= is_eng_idle;
|
||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
*mask |= !is_eng_idle << (GAUDI_ENGINE_ID_MME_0 + i);
|
*mask |= ((u64) !is_eng_idle) <<
|
||||||
|
(GAUDI_ENGINE_ID_MME_0 + i);
|
||||||
if (s) {
|
if (s) {
|
||||||
if (!is_slave)
|
if (!is_slave)
|
||||||
seq_printf(s, fmt, i,
|
seq_printf(s, fmt, i,
|
||||||
|
|||||||
@@ -5166,7 +5166,8 @@ static bool goya_is_device_idle(struct hl_device *hdev, u32 *mask,
|
|||||||
is_idle &= is_eng_idle;
|
is_idle &= is_eng_idle;
|
||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
*mask |= !is_eng_idle << (GOYA_ENGINE_ID_DMA_0 + i);
|
*mask |= ((u64) !is_eng_idle) <<
|
||||||
|
(GOYA_ENGINE_ID_DMA_0 + i);
|
||||||
if (s)
|
if (s)
|
||||||
seq_printf(s, dma_fmt, i, is_eng_idle ? "Y" : "N",
|
seq_printf(s, dma_fmt, i, is_eng_idle ? "Y" : "N",
|
||||||
qm_glbl_sts0, dma_core_sts0);
|
qm_glbl_sts0, dma_core_sts0);
|
||||||
@@ -5189,7 +5190,8 @@ static bool goya_is_device_idle(struct hl_device *hdev, u32 *mask,
|
|||||||
is_idle &= is_eng_idle;
|
is_idle &= is_eng_idle;
|
||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
*mask |= !is_eng_idle << (GOYA_ENGINE_ID_TPC_0 + i);
|
*mask |= ((u64) !is_eng_idle) <<
|
||||||
|
(GOYA_ENGINE_ID_TPC_0 + i);
|
||||||
if (s)
|
if (s)
|
||||||
seq_printf(s, fmt, i, is_eng_idle ? "Y" : "N",
|
seq_printf(s, fmt, i, is_eng_idle ? "Y" : "N",
|
||||||
qm_glbl_sts0, cmdq_glbl_sts0, tpc_cfg_sts);
|
qm_glbl_sts0, cmdq_glbl_sts0, tpc_cfg_sts);
|
||||||
@@ -5209,7 +5211,7 @@ static bool goya_is_device_idle(struct hl_device *hdev, u32 *mask,
|
|||||||
is_idle &= is_eng_idle;
|
is_idle &= is_eng_idle;
|
||||||
|
|
||||||
if (mask)
|
if (mask)
|
||||||
*mask |= !is_eng_idle << GOYA_ENGINE_ID_MME_0;
|
*mask |= ((u64) !is_eng_idle) << GOYA_ENGINE_ID_MME_0;
|
||||||
if (s) {
|
if (s) {
|
||||||
seq_printf(s, fmt, 0, is_eng_idle ? "Y" : "N", qm_glbl_sts0,
|
seq_printf(s, fmt, 0, is_eng_idle ? "Y" : "N", qm_glbl_sts0,
|
||||||
cmdq_glbl_sts0, mme_arch_sts);
|
cmdq_glbl_sts0, mme_arch_sts);
|
||||||
|
|||||||
Reference in New Issue
Block a user