* [patch] samples/bpf: silence shift wrapping warning @ 2017-01-21 4:51 Dan Carpenter 2017-01-22 22:51 ` Alexei Starovoitov 2017-01-24 6:44 ` Alexei Starovoitov 0 siblings, 2 replies; 7+ messages in thread From: Dan Carpenter @ 2017-01-21 4:51 UTC (permalink / raw) To: Arnaldo Carvalho de Melo, Thomas Graf Cc: Alexei Starovoitov, Joe Stringer, David S. Miller, linux-kernel, kernel-janitors max_key is a value in the 0-63 range, so on 32 bit systems the shift could wrap. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> 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); } ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [patch] samples/bpf: silence shift wrapping warning 2017-01-21 4:51 [patch] samples/bpf: silence shift wrapping warning Dan Carpenter @ 2017-01-22 22:51 ` Alexei Starovoitov 2017-01-23 13:27 ` Arnaldo Carvalho de Melo 2017-01-25 11:08 ` David Laight 2017-01-24 6:44 ` Alexei Starovoitov 1 sibling, 2 replies; 7+ messages in thread From: Alexei Starovoitov @ 2017-01-22 22:51 UTC (permalink / raw) To: Dan Carpenter Cc: Arnaldo Carvalho de Melo, Thomas Graf, Alexei Starovoitov, Joe Stringer, David S. Miller, linux-kernel, kernel-janitors, netdev 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 <dan.carpenter@oracle.com> Looks fine. I think 'net-next' is ok. Acked-by: Alexei Starovoitov <ast@kernel.org> > 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); > } > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch] samples/bpf: silence shift wrapping warning 2017-01-22 22:51 ` Alexei Starovoitov @ 2017-01-23 13:27 ` Arnaldo Carvalho de Melo 2017-01-25 11:08 ` David Laight 1 sibling, 0 replies; 7+ messages in thread From: Arnaldo Carvalho de Melo @ 2017-01-23 13:27 UTC (permalink / raw) To: Alexei Starovoitov Cc: Dan Carpenter, Thomas Graf, Alexei Starovoitov, Joe Stringer, David S. Miller, linux-kernel, kernel-janitors, netdev 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 <dan.carpenter@oracle.com> > > Looks fine. I think 'net-next' is ok. I could process these patches, if that would help, - Arnaldo > Acked-by: Alexei Starovoitov <ast@kernel.org> > > 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); > > } > > ^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [patch] samples/bpf: silence shift wrapping warning 2017-01-22 22:51 ` Alexei Starovoitov 2017-01-23 13:27 ` Arnaldo Carvalho de Melo @ 2017-01-25 11:08 ` David Laight 1 sibling, 0 replies; 7+ messages in thread From: David Laight @ 2017-01-25 11:08 UTC (permalink / raw) 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 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 <dan.carpenter@oracle.com> > > Looks fine. I think 'net-next' is ok. > > Acked-by: Alexei Starovoitov <ast@kernel.org> > > > 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch] samples/bpf: silence shift wrapping warning 2017-01-21 4:51 [patch] samples/bpf: silence shift wrapping warning Dan Carpenter 2017-01-22 22:51 ` Alexei Starovoitov @ 2017-01-24 6:44 ` Alexei Starovoitov 2017-01-24 8:46 ` Dan Carpenter 2017-01-24 16:02 ` Arnaldo Carvalho de Melo 1 sibling, 2 replies; 7+ messages in thread From: Alexei Starovoitov @ 2017-01-24 6:44 UTC (permalink / raw) To: Arnaldo Carvalho de Melo Cc: Dan Carpenter, Thomas Graf, Alexei Starovoitov, Joe Stringer, David S. Miller, linux-kernel@vger.kernel.org, kernel-janitors, netdev@vger.kernel.org On Mon, Jan 23, 2017 at 5:27 AM, Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com> wrote: > 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 <dan.carpenter@oracle.com> >> >> Looks fine. I think 'net-next' is ok. > > I could process these patches, if that would help, Thanks for the offer. I don't think there will be conflicts with all the work happening in net-next, but it's best to avoid even possibility of it when we can. Dan, can you please resend the patch cc-ing Dave and netdev ? please mention [PATCH net-next] in the subject. > - Arnaldo > >> Acked-by: Alexei Starovoitov <ast@kernel.org> > >> > 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); >> > } >> > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch] samples/bpf: silence shift wrapping warning 2017-01-24 6:44 ` Alexei Starovoitov @ 2017-01-24 8:46 ` Dan Carpenter 2017-01-24 16:02 ` Arnaldo Carvalho de Melo 1 sibling, 0 replies; 7+ messages in thread From: Dan Carpenter @ 2017-01-24 8:46 UTC (permalink / raw) To: Alexei Starovoitov Cc: Arnaldo Carvalho de Melo, Thomas Graf, Alexei Starovoitov, Joe Stringer, David S. Miller, linux-kernel@vger.kernel.org, kernel-janitors, netdev@vger.kernel.org On Mon, Jan 23, 2017 at 10:44:34PM -0800, Alexei Starovoitov wrote: > On Mon, Jan 23, 2017 at 5:27 AM, Arnaldo Carvalho de Melo > <arnaldo.melo@gmail.com> wrote: > > 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 <dan.carpenter@oracle.com> > >> > >> Looks fine. I think 'net-next' is ok. > > > > I could process these patches, if that would help, > > Thanks for the offer. > I don't think there will be conflicts with all the work happening in net-next, > but it's best to avoid even possibility of it when we can. > Dan, > can you please resend the patch cc-ing Dave and netdev ? > please mention [PATCH net-next] in the subject. > Sure. regards, dan carpenter ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch] samples/bpf: silence shift wrapping warning 2017-01-24 6:44 ` Alexei Starovoitov 2017-01-24 8:46 ` Dan Carpenter @ 2017-01-24 16:02 ` Arnaldo Carvalho de Melo 1 sibling, 0 replies; 7+ messages in thread From: Arnaldo Carvalho de Melo @ 2017-01-24 16:02 UTC (permalink / raw) To: Alexei Starovoitov Cc: Arnaldo Carvalho de Melo, Dan Carpenter, Thomas Graf, Alexei Starovoitov, Joe Stringer, David S. Miller, linux-kernel@vger.kernel.org, kernel-janitors, netdev@vger.kernel.org Em Mon, Jan 23, 2017 at 10:44:34PM -0800, Alexei Starovoitov escreveu: > On Mon, Jan 23, 2017 at 5:27 AM, Arnaldo Carvalho de Melo > <arnaldo.melo@gmail.com> wrote: > > 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 <dan.carpenter@oracle.com> > >> > >> Looks fine. I think 'net-next' is ok. > > > > I could process these patches, if that would help, > > Thanks for the offer. > I don't think there will be conflicts with all the work happening in net-next, > but it's best to avoid even possibility of it when we can. Okay sir, I'll let you know when/if the tests I perform building samples/bpf/ in my containers catch something, - Arnaldo > Dan, > can you please resend the patch cc-ing Dave and netdev ? > please mention [PATCH net-next] in the subject. > > > - Arnaldo > > > >> Acked-by: Alexei Starovoitov <ast@kernel.org> > > > >> > 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); > >> > } > >> > ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-01-25 11:08 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-01-21 4:51 [patch] samples/bpf: silence shift wrapping warning Dan Carpenter 2017-01-22 22:51 ` Alexei Starovoitov 2017-01-23 13:27 ` Arnaldo Carvalho de Melo 2017-01-25 11:08 ` David Laight 2017-01-24 6:44 ` Alexei Starovoitov 2017-01-24 8:46 ` Dan Carpenter 2017-01-24 16:02 ` Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox