netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: netdev@oss.sgi.com
Subject: old NLMSG_OK fix
Date: Mon, 31 May 2004 18:04:27 +0200	[thread overview]
Message-ID: <20040531160427.GA19581@lst.de> (raw)

I just stumbled over NLMSG_OK and RTA_OK changes in the debian kernel
package.  It seems they are from
http://oss.sgi.com/projects/netdev/archive/2000-09/msg00001.html

Any comments?

diff -urN kernel-source-2.6.6/include/linux/netlink.h kernel-source-2.6.6-1/include/linux/netlink.h
--- kernel-source-2.6.6/include/linux/netlink.h	2004-05-10 19:48:07.000000000 +1000
+++ kernel-source-2.6.6-1/include/linux/netlink.h	2004-05-10 22:21:52.000000000 +1000
@@ -73,7 +73,8 @@
 #define NLMSG_DATA(nlh)  ((void*)(((char*)nlh) + NLMSG_LENGTH(0)))
 #define NLMSG_NEXT(nlh,len)	 ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \
 				  (struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len)))
-#define NLMSG_OK(nlh,len) ((len) > 0 && (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \
+#define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && \
+			   (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \
 			   (nlh)->nlmsg_len <= (len))
 #define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len)))
 
@@ -93,6 +94,7 @@
 #ifdef __KERNEL__
 
 #include <linux/capability.h>
+#include <linux/skbuff.h>
 
 struct netlink_skb_parms
 {
diff -urN kernel-source-2.6.6/include/linux/rtnetlink.h kernel-source-2.6.6-1/include/linux/rtnetlink.h
--- kernel-source-2.6.6/include/linux/rtnetlink.h	2004-05-10 19:48:08.000000000 +1000
+++ kernel-source-2.6.6-1/include/linux/rtnetlink.h	2004-05-10 22:21:52.000000000 +1000
@@ -69,7 +69,8 @@
 
 #define RTA_ALIGNTO	4
 #define RTA_ALIGN(len) ( ((len)+RTA_ALIGNTO-1) & ~(RTA_ALIGNTO-1) )
-#define RTA_OK(rta,len) ((len) > 0 && (rta)->rta_len >= sizeof(struct rtattr) && \
+#define RTA_OK(rta,len) ((len) >= (int)sizeof(struct rtattr) && \
+			 (rta)->rta_len >= sizeof(struct rtattr) && \
 			 (rta)->rta_len <= (len))
 #define RTA_NEXT(rta,attrlen)	((attrlen) -= RTA_ALIGN((rta)->rta_len), \
 				 (struct rtattr*)(((char*)(rta)) + RTA_ALIGN((rta)->rta_len)))

             reply	other threads:[~2004-05-31 16:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-31 16:04 Christoph Hellwig [this message]
2004-06-27 17:15 ` old NLMSG_OK fix Christoph Hellwig
2004-06-28  3:51   ` David S. Miller
2004-06-28  9:43     ` Herbert Xu
2004-06-28 18:22       ` David S. Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040531160427.GA19581@lst.de \
    --to=hch@lst.de \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).