Skip to contentSkip to conversation

reglib: fix memset usage

PATCH Applied Christian Lamparter 2 participants 2 messages Nov 11, 2013 – Nov 20, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 reglib: fix memset usage

gcc-4.8 fails to compile reglib due to:

reglib.c:1133:22: error: argument to ‘sizeof’ in ‘memset’ call is
the same expression as the destination; did you mean to dereference it? [-Werror=sizeof-pointer-memaccess]

  memset(rd, 0, sizeof(rd));
                      ^

reglib.c:1155:22: error: argument to ‘sizeof’ in... (same as above)

---
 reglib.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
reglib.c +2 -2
index 9577ada..1e57634 100644
@@ -1127,7 +1127,7 @@ reglib_parse_country_simple(char *line, struct ieee80211_regdomain *rd)
 	char alpha2[2];
 	int hits;
 
-	memset(rd, 0, sizeof(rd));
+	memset(rd, 0, sizeof(*rd));
 	memset(alpha2, 0, sizeof(alpha2));
 	memset(dfs_region_alpha, 0, sizeof(dfs_region_alpha));
 
@@ -1149,7 +1149,7 @@ static int reglib_parse_country_dfs(char *line, struct ieee80211_regdomain *rd)
 	char alpha2[2];
 	int hits;
 
-	memset(rd, 0, sizeof(rd));
+	memset(rd, 0, sizeof(*rd));
 	memset(alpha2, 0, sizeof(alpha2));
 	memset(dfs_region_alpha, 0, sizeof(dfs_region_alpha));
 
Signature · 1 line
1.8.4.2
#1 lore raw
Quoted 10 lines · Christian Lamparter

gcc-4.8 fails to compile reglib due to:

reglib.c:1133:22: error: argument to ‘sizeof’ in ‘memset’ call is
the same expression as the destination; did you mean to dereference it? [-Werror=sizeof-pointer-memaccess]

  memset(rd, 0, sizeof(rd));
                      ^

reglib.c:1155:22: error: argument to ‘sizeof’ in... (same as above)

Thanks, applied and pushed!

Luis