decnet: Fix complier warning
Subsystems (2)
This patch fixes a warning seen during compiling dn_dev.c. The warning is harmless since we know that the structure length in question is less than 2^32 bytes, but this fixes it anyway.
net/decnet/dn_dev.c +1 -1
@@ -152,7 +152,7 @@ static struct dn_dev_parms dn_dev_list[] = {#define DN_DEV_LIST_SIZE ARRAY_SIZE(dn_dev_list) -#define DN_DEV_PARMS_OFFSET (x) ((int) ((char *) &((struct dn_dev_parms *)0)->x)) +#define DN_DEV_PARMS_OFFSET (x) ((long) ((char *) &((struct dn_dev_parms *)0)->x))#ifdef CONFIG_SYSCTL
Quoted 12 lines · Steven Whitehouse
This patch fixes a warning seen during compiling
dn_dev.c. The warning is harmless since we know that the structure length in question is less than 2^32 bytes, but this fixes it anyway.Signed-off-by Steven Whitehouse <[email protected]>Cc Christine Caulfield <[email protected]>net/decnet/dn_dev.c +0
-0
net/decnet/dn_dev.c static struct dn_dev_parms dn_dev_list[] = { · line 158
Quoted 8 lines
net/decnet/dn_dev.c +1
-1@@ -152,7 +152,7 @@ static struct dn_dev_parms dn_dev_list[] = {#define DN_DEV_LIST_SIZE ARRAY_SIZE(dn_dev_list) -#define DN_DEV_PARMS_OFFSET (x) ((int) ((char *) &((struct dn_dev_parms *)0)->x)) +#define DN_DEV_PARMS_OFFSET (x) ((long) ((char *) &((struct dn_dev_parms *)0)->x))#ifdef CONFIG_SYSCTL
Or you could make this use offsetof(). Daring, I know, it's only been a standard macro for nearly 20 years.
Ben.
Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
Hi,
Quoted 19 lines · Ben Hutchings
Quoted 18 lines · Steven Whitehouse
This patch fixes a warning seen during compiling
dn_dev.c. The warning is harmless since we know that the structure length in question is less than 2^32 bytes, but this fixes it anyway.Signed-off-by Steven Whitehouse <[email protected]>Cc Christine Caulfield <[email protected]>net/decnet/dn_dev.c +1
-1@@ -152,7 +152,7 @@ static struct dn_dev_parms dn_dev_list[] = {#define DN_DEV_LIST_SIZE ARRAY_SIZE(dn_dev_list) -#define DN_DEV_PARMS_OFFSET (x) ((int) ((char *) &((struct dn_dev_parms *)0)->x)) +#define DN_DEV_PARMS_OFFSET (x) ((long) ((char *) &((struct dn_dev_parms *)0)->x))
Quoted 8 lines
net/decnet/dn_dev.c static struct dn_dev_parms dn_dev_list[] = { · line 158
Quoted 2 lines
net/decnet/dn_dev.c +0
-0#ifdef CONFIG_SYSCTL Or you could make this use
offsetof(). Daring, I know, it's only been a standard macro for nearly 20 years.Ben.
Yes, thats true. The whole set of code is rather suspect to say the least and I was going for the minimal fix. Its a long time since I last looked at this code so I don't remember exactly why it was done in that way,
Steve.
David Miller
maintainerFrom: Steven Whitehouse <[email protected]>
Date: Wed, 15 Oct 2008 13:40:35 +0100
Quoted 8 lines · Ben Hutchings
Quoted 2 lines
Or you could make this use
offsetof(). Daring, I know, it's only been a standard macro for nearly 20 years.Yes, thats true. The whole set of code is rather suspect to say the least and I was going for the minimal fix. Its a long time since I last looked at this code so I don't remember exactly why it was done in that way,
I'm going to check in something like the following:
net/decnet/dn_dev.c +1 -1
@@ -152,7 +152,7 @@ static struct dn_dev_parms dn_dev_list[] = {#define DN_DEV_LIST_SIZE ARRAY_SIZE(dn_dev_list) -#define DN_DEV_PARMS_OFFSET (x) ((int) ((char *) &((struct dn_dev_parms *)0)->x)) +#define DN_DEV_PARMS_OFFSET (x) offsetof(struct dn_dev_parms, x)#ifdef CONFIG_SYSCTL