From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751162AbdAWN2H (ORCPT ); Mon, 23 Jan 2017 08:28:07 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33744 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750703AbdAWN2F (ORCPT ); Mon, 23 Jan 2017 08:28:05 -0500 Date: Mon, 23 Jan 2017 11:27:59 -0200 From: Arnaldo Carvalho de Melo To: Alexei Starovoitov Cc: Dan Carpenter , 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 Message-ID: <20170123132759.GA8227@redhat.com> References: <20170121045143.GC15269@mwanda> <20170122225123.GA73160@ast-mbp.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170122225123.GA73160@ast-mbp.thefacebook.com> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.20 (2009-12-10) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 23 Jan 2017 13:28:05 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Sun, Jan 22, 2017 at 02:51:25PM -0800, Alexei Starovoitov escreveu: > 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. I could process these patches, if that would help, - Arnaldo > 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); > > } > > From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnaldo Carvalho de Melo Date: Mon, 23 Jan 2017 13:27:59 +0000 Subject: Re: [patch] samples/bpf: silence shift wrapping warning Message-Id: <20170123132759.GA8227@redhat.com> List-Id: References: <20170121045143.GC15269@mwanda> <20170122225123.GA73160@ast-mbp.thefacebook.com> In-Reply-To: <20170122225123.GA73160@ast-mbp.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Alexei Starovoitov Cc: Dan Carpenter , Thomas Graf , Alexei Starovoitov , Joe Stringer , "David S. Miller" , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, netdev@vger.kernel.org Em Sun, Jan 22, 2017 at 02:51:25PM -0800, Alexei Starovoitov escreveu: > 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. I could process these patches, if that would help, - Arnaldo > 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); > > } > >