Re: [PATCH] kselftest: ftrace: Fix to compare a zero-filled hex value

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

 



On Thu, 23 Mar 2017 22:33:32 +0900
Masami Hiramatsu <mhiramat@xxxxxxxxxx> wrote:

> Fix to compare a zero-filled hexadecimal value with a part of
> string of long hexadecimal value.
> 
> In check_types(), the last part of testcase compares with
> the hex value formatted by "%x" with a part of a string of
> long hex value (trimmed by tail -c and head -c). However,
> if that part of long hex value contains zero (e.g. "05" of
> "a3082059"), printf generated value (e.g. "5") is diffrent
> string, and the test case failed.
> 
> To fix this, pass "%02x" instead of "%x" to printf.

I was able to trigger the bug, and this does fix it.

Acked-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>

Shuah,

Can you take this in your tree?

-- Steve

> 
> Signed-off-by: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
> ---
>  .../ftrace/test.d/kprobe/kprobe_args_type.tc       |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
> index 0a78705..c75faef 100644
> --- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
> +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_type.tc
> @@ -26,7 +26,7 @@ check_types() {
>    test $X2 = $X3
>    test 0x$X3 = $3
>  
> -  B4=`printf "%x" $4`
> +  B4=`printf "%02x" $4`
>    B3=`echo -n $X3 | tail -c 3 | head -c 2`
>    test $B3 = $B4
>  }

--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux