Bug#621075: manpages-dev: rtnetlink documents wrong return type for RTA_PAYLOAD
Michael Kerrisk (man-pages) left as an exercise for the reader: > >> RTA_PAYLOAD casts the expression to int, at least in 2.6.38.2. It's > >> documented > >> as unsinged int. Trivial patch included. > > > > Even since 2.6.11: > > http://lxr.linux.no/#linux+v2.6.11/include/linux/rtnetlink.h#L120 > > I'm missing it. How is it concluded that the result is cast to (int)? > > Looking at the header file, one half of a larrger expression is cast > to (int), but not the whole expression. I agree with Michael; my patch to the manpage is invalid. I remember this being connected to a gcc signed-with-unsigned warning. Perhaps it applied to the expression itself, rather than the result? -- nick black http://www.sprezzatech.com -- unix and hpc consulting to make an apple pie from scratch, you need first invent a universe. -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Bug#621075: manpages-dev: rtnetlink documents wrong return type for RTA_PAYLOAD
>> RTA_PAYLOAD casts the expression to int, at least in 2.6.38.2. It's >> documented >> as unsinged int. Trivial patch included. > > Even since 2.6.11: > http://lxr.linux.no/#linux+v2.6.11/include/linux/rtnetlink.h#L120 I'm missing it. How is it concluded that the result is cast to (int)? Looking at the header file, one half of a larrger expression is cast to (int), but not the whole expression. Cheers. Michael >> The kernel header probably ought be modified not to perform this rather >> questionable cast, in which case RTA_LENGTH()'s result type would be >> inherited, >> but that's an issue for another bug. > >> diff -ur manpages-pristine//man3/rtnetlink.3 manpages-3.27//man3/rtnetlink.3 >> --- manpages-pristine//man3/rtnetlink.3 2011-04-06 05:13:34.137124578 >> -0500 >> +++ manpages-3.27//man3/rtnetlink.3 2011-04-06 05:13:55.033179278 -0500 >> @@ -23,7 +23,7 @@ >> .sp >> .BI "void *RTA_DATA(struct rtattr *" rta ); >> .sp >> -.BI "unsigned int RTA_PAYLOAD(struct rtattr *" rta ); >> +.BI "int RTA_PAYLOAD(struct rtattr *" rta ); >> .sp >> .BI "struct rtattr *RTA_NEXT(struct rtattr *" rta \ >> ", unsigned int " rtabuflen ); > > Patch forwarded on the linux-man mailing list, thanks. > > -- > Simon Paillard > > > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Author of "The Linux Programming Interface"; http://man7.org/tlpi/ -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Bug#621075: manpages-dev: rtnetlink documents wrong return type for RTA_PAYLOAD
tags 621075 +confirmed thanks On Wed, Apr 06, 2011 at 05:18:18AM -0500, nick black wrote: > Package: manpages-dev > Version: 3.27-1 > Severity: normal > Tags: patch > > RTA_PAYLOAD casts the expression to int, at least in 2.6.38.2. It's documented > as unsinged int. Trivial patch included. Even since 2.6.11: http://lxr.linux.no/#linux+v2.6.11/include/linux/rtnetlink.h#L120 > The kernel header probably ought be modified not to perform this rather > questionable cast, in which case RTA_LENGTH()'s result type would be > inherited, > but that's an issue for another bug. > diff -ur manpages-pristine//man3/rtnetlink.3 manpages-3.27//man3/rtnetlink.3 > --- manpages-pristine//man3/rtnetlink.3 2011-04-06 05:13:34.137124578 > -0500 > +++ manpages-3.27//man3/rtnetlink.3 2011-04-06 05:13:55.033179278 -0500 > @@ -23,7 +23,7 @@ > .sp > .BI "void *RTA_DATA(struct rtattr *" rta ); > .sp > -.BI "unsigned int RTA_PAYLOAD(struct rtattr *" rta ); > +.BI "int RTA_PAYLOAD(struct rtattr *" rta ); > .sp > .BI "struct rtattr *RTA_NEXT(struct rtattr *" rta \ > ", unsigned int " rtabuflen ); Patch forwarded on the linux-man mailing list, thanks. -- Simon Paillard -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Bug#621075: manpages-dev: rtnetlink documents wrong return type for RTA_PAYLOAD
Package: manpages-dev Version: 3.27-1 Severity: normal Tags: patch RTA_PAYLOAD casts the expression to int, at least in 2.6.38.2. It's documented as unsinged int. Trivial patch included. The kernel header probably ought be modified not to perform this rather questionable cast, in which case RTA_LENGTH()'s result type would be inherited, but that's an issue for another bug. -- System Information: Debian Release: wheezy/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64) Kernel: Linux 2.6.38.2 (SMP w/4 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages manpages-dev depends on: ii manpages 3.27-1 Manual pages about using a GNU/Lin manpages-dev recommends no packages. Versions of packages manpages-dev suggests: ii man-db [man-browser] 2.5.9-4on-line manual pager -- no debconf information diff -ur manpages-pristine//man3/rtnetlink.3 manpages-3.27//man3/rtnetlink.3 --- manpages-pristine//man3/rtnetlink.3 2011-04-06 05:13:34.137124578 -0500 +++ manpages-3.27//man3/rtnetlink.3 2011-04-06 05:13:55.033179278 -0500 @@ -23,7 +23,7 @@ .sp .BI "void *RTA_DATA(struct rtattr *" rta ); .sp -.BI "unsigned int RTA_PAYLOAD(struct rtattr *" rta ); +.BI "int RTA_PAYLOAD(struct rtattr *" rta ); .sp .BI "struct rtattr *RTA_NEXT(struct rtattr *" rta \ ", unsigned int " rtabuflen );