From fd817962f962bf279833f001c65bfc0c1417ae9a Mon Sep 17 00:00:00 2001 From: JingPiao Chen Date: Wed, 5 Jul 2017 09:39:34 +0800 Subject: [PATCH] tests: fix TEST_NLATTR_OBJECT and TEST_NLATTR_ARRAY for large objects commit v4.17-161-gdbd0605 that adjusted TEST_NLATTR_OBJECT and TEST_NLATTR_ARRAY for large objects, only changed the pattern print length, large length still can be specified as nla_data_len, resulting to output mismatch. * tests/test_nlattr.h (TEST_NLATTR_OBJECT): Pass "plen" both as nla_data_len and slen arguments of TEST_NLATTR_ in len < sizeof(object) case. (TEST_NLATTR_ARRAY): Likewise, Pass "plen" both as nla_data_len and slen arguments of TEST_NLATTR_ in len < sizeof(object[0]) case. --- 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 fd8e036c..4585893d 100644 --- a/tests/test_nlattr.h +++ b/tests/test_nlattr.h @@ -107,8 +107,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_), \ @@ -138,8 +137,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_), \ -- 2.40.0