diff mbox

reglib: fix memset usage

Message ID 2765421.8z1iAPSgk6@blech (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Christian Lamparter Nov. 11, 2013, 7:39 p.m. UTC
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)

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
---
 reglib.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Luis R. Rodriguez Nov. 20, 2013, 2:07 p.m. UTC | #1
On Mon, Nov 11, 2013 at 8:39 PM, Christian Lamparter
<chunkeey@googlemail.com> wrote:
> 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)
>
> Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>

Thanks, applied and pushed!

  Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/reglib.c b/reglib.c
index 9577ada..1e57634 100644
--- a/reglib.c
+++ b/reglib.c
@@ -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));