From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH iproute2 v3] json_print: Fix hidden 64-bit type promotion Date: Wed, 25 Apr 2018 11:11:41 -0700 Message-ID: <20180425111141.3b6488bd@xeon-e3> References: <20180425143022.6986-1-toke@toke.dk> <20180425152857.26359-1-toke@toke.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: netdev@vger.kernel.org To: Toke =?UTF-8?B?SMO4aWxhbmQtSsO4cmdlbnNlbg==?= Return-path: Received: from mail-pf0-f174.google.com ([209.85.192.174]:44141 "EHLO mail-pf0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751084AbeDYSLo (ORCPT ); Wed, 25 Apr 2018 14:11:44 -0400 Received: by mail-pf0-f174.google.com with SMTP id q22so962572pff.11 for ; Wed, 25 Apr 2018 11:11:43 -0700 (PDT) In-Reply-To: <20180425152857.26359-1-toke@toke.dk> Sender: netdev-owner@vger.kernel.org List-ID: On Wed, 25 Apr 2018 17:28:57 +0200 Toke H=C3=B8iland-J=C3=B8rgensen wrote: > print_uint() will silently promote its variable type to uint64_t, but the= re > is nothing that ensures that the format string specifier passed along with > it fits (and the function name suggest to pass "%u"). >=20 > Fix this by changing print_uint() to use a native 'unsigned int' type, and > introduce a separate print_u64() function for printing 64-bit values. All > call sites that were actually printing 64-bit values using print_uint() a= re > converted to use print_u64() instead. >=20 > Since print_int() was already using native int types, just add a > print_s64() to match, but don't convert any call sites. For symmetry, > also add a print_luint() method (with no users). >=20 > Signed-off-by: Toke H=C3=B8iland-J=C3=B8rgensen Looks good, applied. This also fixes glitches in mroute and neigh output.