Message ID | 20200624231230.17406-1-daniel.santos@pobox.com |
---|---|
State | Changes Requested |
Headers | show |
Series | musl: fix signed compare warning | expand |
On 6/25/20 1:12 AM, Daniel Santos wrote: > Signed-off-by: Daniel Santos <daniel.santos@pobox.com> > --- > .../210-Fix-signed-compare-warning.patch | 26 +++++++++++++++++++ > 1 file changed, 26 insertions(+) > create mode 100644 toolchain/musl/patches/210-Fix-signed-compare-warning.patch > > diff --git a/toolchain/musl/patches/210-Fix-signed-compare-warning.patch b/toolchain/musl/patches/210-Fix-signed-compare-warning.patch > new file mode 100644 > index 0000000000..5d5d2f865e > --- /dev/null > +++ b/toolchain/musl/patches/210-Fix-signed-compare-warning.patch > @@ -0,0 +1,26 @@ > +From 7627aac4e5381546baeb0d6bef6675e9107cd751 Mon Sep 17 00:00:00 2001 > +From: Daniel Santos <daniel.santos@pobox.com> > +Date: Sat, 25 Apr 2020 12:18:15 -0500 > +Subject: Fix signed compare warning > + > +Signed-off-by: Daniel Santos <daniel.santos@pobox.com> > +--- > + src/thread/__timedwait.c | 2 +- > + 1 file changed, 1 insertion(+), 1 deletion(-) > + > +diff --git a/src/thread/__timedwait.c b/src/thread/__timedwait.c > +index 666093be..9829b93e 100644 > +--- a/src/thread/__timedwait.c > ++++ b/src/thread/__timedwait.c > +@@ -38,7 +38,7 @@ int __timedwait_cp(volatile int *addr, int val, > + if (priv) priv = FUTEX_PRIVATE; > + > + if (at) { > +- if (at->tv_nsec >= 1000000000UL) return EINVAL; > ++ if ((unsigned long)at->tv_nsec >= 1000000000UL) return EINVAL; > + if (__clock_gettime(clk, &to)) return EINVAL; > + to.tv_sec = at->tv_sec - to.tv_sec; > + if ((to.tv_nsec = at->tv_nsec - to.tv_nsec) < 0) { > +-- > +2.24.1 > + > Thank you for also sending this to upstream musl. As this was rejected upstream I would also reject it for OpenWrt for now: https://www.openwall.com/lists/musl/2020/06/26/4 Hauke
On 7/4/20 10:19 AM, Hauke Mehrtens wrote: > On 6/25/20 1:12 AM, Daniel Santos wrote: >> Signed-off-by: Daniel Santos <daniel.santos@pobox.com> >> --- >> .../210-Fix-signed-compare-warning.patch | 26 +++++++++++++++++++ >> 1 file changed, 26 insertions(+) >> create mode 100644 toolchain/musl/patches/210-Fix-signed-compare-warning.patch >> >> diff --git a/toolchain/musl/patches/210-Fix-signed-compare-warning.patch b/toolchain/musl/patches/210-Fix-signed-compare-warning.patch >> new file mode 100644 >> index 0000000000..5d5d2f865e >> --- /dev/null >> +++ b/toolchain/musl/patches/210-Fix-signed-compare-warning.patch >> @@ -0,0 +1,26 @@ >> +From 7627aac4e5381546baeb0d6bef6675e9107cd751 Mon Sep 17 00:00:00 2001 >> +From: Daniel Santos <daniel.santos@pobox.com> >> +Date: Sat, 25 Apr 2020 12:18:15 -0500 >> +Subject: Fix signed compare warning >> + >> +Signed-off-by: Daniel Santos <daniel.santos@pobox.com> >> +--- >> + src/thread/__timedwait.c | 2 +- >> + 1 file changed, 1 insertion(+), 1 deletion(-) >> + >> +diff --git a/src/thread/__timedwait.c b/src/thread/__timedwait.c >> +index 666093be..9829b93e 100644 >> +--- a/src/thread/__timedwait.c >> ++++ b/src/thread/__timedwait.c >> +@@ -38,7 +38,7 @@ int __timedwait_cp(volatile int *addr, int val, >> + if (priv) priv = FUTEX_PRIVATE; >> + >> + if (at) { >> +- if (at->tv_nsec >= 1000000000UL) return EINVAL; >> ++ if ((unsigned long)at->tv_nsec >= 1000000000UL) return EINVAL; >> + if (__clock_gettime(clk, &to)) return EINVAL; >> + to.tv_sec = at->tv_sec - to.tv_sec; >> + if ((to.tv_nsec = at->tv_nsec - to.tv_nsec) < 0) { >> +-- >> +2.24.1 >> + >> > Thank you for also sending this to upstream musl. > > As this was rejected upstream I would also reject it for OpenWrt for now: > https://www.openwall.com/lists/musl/2020/06/26/4 > > Hauke > Thank you Hauke. It appears that the musl mailing list is "reply to list only", so I didn't see the response! I've updated my mail filters so I'll get them in my inbox in the future. I'm not sure how to follow up the upstream response. I like warnings, but I'm guessing upstream relies on rigorous scrutiny over warnings. Either way, if we enable -Wextra in OpenWRT (or elsewhere, as I had), we'll want to add -Wno-sign-compare. It would be good to document this somewhere. Anyway, thank you. Daniel
diff --git a/toolchain/musl/patches/210-Fix-signed-compare-warning.patch b/toolchain/musl/patches/210-Fix-signed-compare-warning.patch new file mode 100644 index 0000000000..5d5d2f865e --- /dev/null +++ b/toolchain/musl/patches/210-Fix-signed-compare-warning.patch @@ -0,0 +1,26 @@ +From 7627aac4e5381546baeb0d6bef6675e9107cd751 Mon Sep 17 00:00:00 2001 +From: Daniel Santos <daniel.santos@pobox.com> +Date: Sat, 25 Apr 2020 12:18:15 -0500 +Subject: Fix signed compare warning + +Signed-off-by: Daniel Santos <daniel.santos@pobox.com> +--- + src/thread/__timedwait.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/thread/__timedwait.c b/src/thread/__timedwait.c +index 666093be..9829b93e 100644 +--- a/src/thread/__timedwait.c ++++ b/src/thread/__timedwait.c +@@ -38,7 +38,7 @@ int __timedwait_cp(volatile int *addr, int val, + if (priv) priv = FUTEX_PRIVATE; + + if (at) { +- if (at->tv_nsec >= 1000000000UL) return EINVAL; ++ if ((unsigned long)at->tv_nsec >= 1000000000UL) return EINVAL; + if (__clock_gettime(clk, &to)) return EINVAL; + to.tv_sec = at->tv_sec - to.tv_sec; + if ((to.tv_nsec = at->tv_nsec - to.tv_nsec) < 0) { +-- +2.24.1 +
Signed-off-by: Daniel Santos <daniel.santos@pobox.com> --- .../210-Fix-signed-compare-warning.patch | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 toolchain/musl/patches/210-Fix-signed-compare-warning.patch