[PATCH v6 06/18] netlink: decode AF_INET inet_diag_msg attributes
Dmitry V. Levin
ldv at altlinux.org
Tue Jun 27 17:13:52 UTC 2017
On Tue, Jun 27, 2017 at 06:10:08PM +0800, JingPiao Chen wrote:
[...]
> +static bool
> +decode_meminfo(struct tcb *tcp, kernel_ulong_t addr,
> + kernel_ulong_t len, void *const opaque_data)
> +{
> + uint32_t mem;
> + int nmemb = len / sizeof(mem);
> +
> + if (!nmemb)
> + return false;
> +
> + if (nmemb > SK_MEMINFO_VARS)
> + nmemb = SK_MEMINFO_VARS;
> +
> + print_array(tcp, addr, nmemb, &mem, sizeof(mem),
> + umoven_or_printaddr, print_meminfo, 0);
> +
> + return true;
> +}
The type of "nmemb" should be size_t.
Imagine len == 2^34-4, then nmemb == 2^32-1, and if nmemb is a signed int,
then nmemb == -1, and -1UL is passed to print_array.
--
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/20170627/0098255e/attachment.bin>
More information about the Strace-devel
mailing list