[PATCH bpf-next] use correct format string specifier for unsigned 32 bounds

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

 



From fd076dc5f2bd5ec4e9cb49530e77cf2d3e4f42c2 Mon Sep 17 00:00:00 2001
From: Benedict Schlueter <benedict.schlueter@xxxxxx>
Date: Wed, 2 Jun 2021 21:42:39 +0200
Subject: [PATCH bpf-next]
 use correct format string specifier for unsigned 32 bounds

when printing an unsigned value, it should be a positive number

verifier log before the patch
([...],s32_max_value=-2,u32_min_value=-16,u32_max_value=-2)

verifier log after the patch
([...],s32_max_value=-2,u32_min_value=4294967280,u32_max_value=4294967294)


Fixes: 3f50f132d840 ("bpf: Verifier, do explicit ALU32 bounds tracking")
Signed-off-by: Benedict Schlueter <benedict.schlueter@xxxxxx>
---
 kernel/bpf/verifier.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 1de4b8c6ee42..ea482ebaeb26 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -690,12 +690,12 @@ static void print_verifier_state(struct bpf_verifier_env *env,
                         (int)(reg->s32_max_value));
                 if (reg->u32_min_value != reg->umin_value &&
                     reg->u32_min_value != U32_MIN)
-                    verbose(env, ",u32_min_value=%d",
-                        (int)(reg->u32_min_value));
+                    verbose(env, ",u32_min_value=%u",
+                        (unsigned int)(reg->u32_min_value));
                 if (reg->u32_max_value != reg->umax_value &&
                     reg->u32_max_value != U32_MAX)
-                    verbose(env, ",u32_max_value=%d",
-                        (int)(reg->u32_max_value));
+                    verbose(env, ",u32_max_value=%u",
+                        (unsigned int)(reg->u32_max_value));
             }
             verbose(env, ")");
         }
--
2.31.1





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux