From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752065AbdAYLJC convert rfc822-to-8bit (ORCPT ); Wed, 25 Jan 2017 06:09:02 -0500 Received: from smtp-out4.electric.net ([192.162.216.191]:59332 "EHLO smtp-out4.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751741AbdAYLJA (ORCPT ); Wed, 25 Jan 2017 06:09:00 -0500 From: David Laight To: "'Alexei Starovoitov'" , Dan Carpenter CC: Arnaldo Carvalho de Melo , Thomas Graf , Alexei Starovoitov , Joe Stringer , "David S. Miller" , "linux-kernel@vger.kernel.org" , "kernel-janitors@vger.kernel.org" , "netdev@vger.kernel.org" Subject: RE: [patch] samples/bpf: silence shift wrapping warning Thread-Topic: [patch] samples/bpf: silence shift wrapping warning Thread-Index: AQHSdQMujKzheRSLfkKpMMNWAZso3aFJDD9A Date: Wed, 25 Jan 2017 11:08:51 +0000 Message-ID: <063D6719AE5E284EB5DD2968C1650D6DB026DD27@AcuExch.aculab.com> References: <20170121045143.GC15269@mwanda> <20170122225123.GA73160@ast-mbp.thefacebook.com> In-Reply-To: <20170122225123.GA73160@ast-mbp.thefacebook.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.202.99.200] Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Outbound-IP: 213.249.233.130 X-Env-From: David.Laight@ACULAB.COM X-Proto: esmtps X-Revdns: X-HELO: AcuExch.aculab.com X-TLS: TLSv1:AES128-SHA:128 X-Authenticated_ID: X-PolicySMART: 3396946, 3397078 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexei Starovoitov > Sent: 22 January 2017 22:51 > On Sat, Jan 21, 2017 at 07:51:43AM +0300, Dan Carpenter wrote: > > max_key is a value in the 0-63 range, so on 32 bit systems the shift > > could wrap. > > > > Signed-off-by: Dan Carpenter > > Looks fine. I think 'net-next' is ok. > > Acked-by: Alexei Starovoitov > > > diff --git a/samples/bpf/lwt_len_hist_user.c b/samples/bpf/lwt_len_hist_user.c > > index ec8f3bb..bd06eef 100644 > > --- a/samples/bpf/lwt_len_hist_user.c > > +++ b/samples/bpf/lwt_len_hist_user.c > > @@ -68,7 +68,7 @@ int main(int argc, char **argv) > > for (i = 1; i <= max_key + 1; i++) { > > stars(starstr, data[i - 1], max_value, MAX_STARS); > > printf("%8ld -> %-8ld : %-8ld |%-*s|\n", > > - (1l << i) >> 1, (1l << i) - 1, data[i - 1], > > + (1ULL << i) >> 1, (1ULL << i) - 1, data[i - 1], > > MAX_STARS, starstr); > > } The format effectors are wrong on 32bit systems. David