lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1424080072.31903.557.camel@linux.intel.com>
Date:	Mon, 16 Feb 2015 11:47:52 +0200
From:	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:	Wang Long <long.wanglong@...wei.com>
Cc:	akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
	peifeiyue@...wei.com
Subject: Re: [PATCH] test-hexdump: test the return value of the
 hex_dump_to_buffer

On Sun, 2015-02-15 at 09:50 +0000, Wang Long wrote:
> As the function hex_dump_to_buffer returns the amount of bytes placed
> in the buffer without terminating NUL. the test-hexdump should test
> the return value of it.

I don't think it's needed. When the prototype was changed the new test
case had been introduced to cover the overflow cases, i.e.
test_hexdump_overflow().

> 
> Signed-off-by: Wang Long <long.wanglong@...wei.com>
> ---
>  lib/test-hexdump.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/test-hexdump.c b/lib/test-hexdump.c
> index daf29a39..9243be7 100644
> --- a/lib/test-hexdump.c
> +++ b/lib/test-hexdump.c
> @@ -52,8 +52,9 @@ static void __init test_hexdump(size_t len, int rowsize, int groupsize,
>  	size_t l = len;
>  	int gs = groupsize, rs = rowsize;
>  	unsigned int i;
> +	int r;
>  
> -	hex_dump_to_buffer(data_b, l, rs, gs, real, sizeof(real), ascii);
> +	r = hex_dump_to_buffer(data_b, l, rs, gs, real, sizeof(real), ascii);
>  
>  	if (rs != 16 && rs != 32)
>  		rs = 16;
> @@ -96,7 +97,7 @@ static void __init test_hexdump(size_t len, int rowsize, int groupsize,
>  
>  	*p = '\0';
>  
> -	if (strcmp(test, real)) {
> +	if (strcmp(test, real) || r != strlen(real)) {
>  		pr_err("Len: %zu row: %d group: %d\n", len, rowsize, groupsize);
>  		pr_err("Result: '%s'\n", real);
>  		pr_err("Expect: '%s'\n", test);


-- 
Andy Shevchenko <andriy.shevchenko@...el.com>
Intel Finland Oy

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ