[PATCH v4 05/11] tests: fix TEST_NLATTR_OBJECT and TEST_NLATTR_ARRAY use for large objects

Dmitry V. Levin ldv at altlinux.org
Thu Jul 6 11:48:51 UTC 2017


On Thu, Jul 06, 2017 at 09:57:31AM +0800, JingPiao Chen wrote:
> commit v4.17-161-gdbd0605 adjust TEST_NLATTR_OBJECT and
> TEST_NLATTR_ARRAY for large objects, only change the pattern
> print length, still pass a big length for nla_data_len, do not
> change strace output, still output '"STR"...'.
> 
> * tests/test_nlattr.h (TEST_NLATTR_OBJECT, TEST_NLATTR_ARRAY):
> In case of len < sizeof(object), pass plen as nla_data_len and slen.
> ---
>  tests/test_nlattr.h | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/test_nlattr.h b/tests/test_nlattr.h
> index 9c15c33..4a2af02 100644
> --- a/tests/test_nlattr.h
> +++ b/tests/test_nlattr.h
> @@ -108,8 +108,7 @@ print_nlattr(const unsigned int nla_len, const char *const nla_type)
>  		TEST_NLATTR_((fd_), (nlh0_), (hdrlen_),			\
>  			(init_msg_), (print_msg_),			\
>  			(nla_type_), #nla_type_,			\
> -			sizeof(obj_) - 1,				\
> -			(pattern_), sizeof(obj_) - 1,			\
> +			plen, (pattern_), plen,				\
>  			print_quoted_hex((pattern_), plen));		\
>  		/* short read of sizeof(obj_) */			\
>  		TEST_NLATTR_((fd_), (nlh0_), (hdrlen_),			\
> @@ -139,8 +138,7 @@ print_nlattr(const unsigned int nla_len, const char *const nla_type)
>  		TEST_NLATTR_((fd_), (nlh0_), (hdrlen_),			\
>  			(init_msg_), (print_msg_),			\
>  			(nla_type_), #nla_type_,			\
> -			sizeof((obj_)[0]) - 1,				\
> -			(pattern_), sizeof((obj_)[0]) - 1,		\
> +			plen, (pattern_), plen,				\
>  			print_quoted_hex((pattern_), plen));		\
>  		/* sizeof((obj_)[0]) < len < sizeof(obj_) */		\
>  		TEST_NLATTR_((fd_), (nlh0_), (hdrlen_),			\

I don't see why this change is needed.  I thought it's fine to pass an
object larger than plen as long as it's smaller than expected by strace.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20170706/94dc37e9/attachment.bin>


More information about the Strace-devel mailing list