Skip to contentSkip to conversation

target/arm: add bounding a->imm assertion

PATCH New Anastasia Belova 1 participant 1 message Jul 24, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/arm: add bounding a->imm assertion

Add an assertion similar to that in the do_shr_narrow(). This will make sure that functions from sshll_ops have correct arguments.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

---
 target/arm/tcg/translate-sve.c | 1 +
 1 file changed, 1 insertion(+)
target/arm/tcg/translate-sve.c +1 -0
index d23be477b4..47ada85c92 100644
@@ -6250,6 +6250,7 @@ static bool do_shll_tb(DisasContext *s, arg_rri_esz *a,
     if (a->esz < 0 || a->esz > 2) {
         return false;
     }
+    assert(a->imm > 0 && a->imm <= (8 << a->esz));
     if (sve_access_check(s)) {
         unsigned vsz = vec_full_reg_size(s);
         tcg_gen_gvec_2i(vec_full_reg_offset(s, a->rd),
Signature · 1 line
2.47.0