[PATCH] Staging: gdm72xx: Fix sparse warning

From: Ksenija Stanojevic
Date: Fri Nov 06 2015 - 00:26:52 EST


Fix following sparse warnings by adding new structure for user-space
data (struct data_us) in wm_ioctl.h:

drivers/staging/gdm72xx/gdm_wimax.c:381:37: warning: incorrect type in
argument 1 (different address spaces)
drivers/staging/gdm72xx/gdm_wimax.c:381:37: expected void [noderef]
<asn:1>*to
drivers/staging/gdm72xx/gdm_wimax.c:381:37: got void *buf
drivers/staging/gdm72xx/gdm_wimax.c:404:41: warning: incorrect type in
argument 2 (different address spaces)
drivers/staging/gdm72xx/gdm_wimax.c:404:41: expected void const
[noderef] <asn:1>*from
drivers/staging/gdm72xx/gdm_wimax.c:404:41: got void *buf

Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@xxxxxxxxx>
---
drivers/staging/gdm72xx/gdm_wimax.c | 8 ++++----
drivers/staging/gdm72xx/wm_ioctl.h | 6 ++++++
2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/gdm72xx/gdm_wimax.c b/drivers/staging/gdm72xx/gdm_wimax.c
index b8eea21..362a980 100644
--- a/drivers/staging/gdm72xx/gdm_wimax.c
+++ b/drivers/staging/gdm72xx/gdm_wimax.c
@@ -363,7 +363,7 @@ static void kdelete(void **buf)
}
}

-static int gdm_wimax_ioctl_get_data(struct data_s *dst, struct data_s *src)
+static int gdm_wimax_ioctl_get_data(struct data_us *dst, struct data_s *src)
{
int size;

@@ -379,7 +379,7 @@ static int gdm_wimax_ioctl_get_data(struct data_s *dst, struct data_s *src)
return 0;
}

-static int gdm_wimax_ioctl_set_data(struct data_s *dst, struct data_s *src)
+static int gdm_wimax_ioctl_set_data(struct data_s *dst, struct data_us *src)
{
if (!src->size) {
dst->size = 0;
@@ -469,7 +469,7 @@ static int gdm_wimax_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
}
if (req->cmd == SIOCG_DATA) {
ret = gdm_wimax_ioctl_get_data(
- &req->data, &nic->sdk_data[req->data_id]);
+ &req->udata, &nic->sdk_data[req->data_id]);
if (ret < 0)
return ret;
} else if (req->cmd == SIOCS_DATA) {
@@ -481,7 +481,7 @@ static int gdm_wimax_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
req->data.buf);
}
ret = gdm_wimax_ioctl_set_data(
- &nic->sdk_data[req->data_id], &req->data);
+ &nic->sdk_data[req->data_id], &req->udata);
if (ret < 0)
return ret;
}
diff --git a/drivers/staging/gdm72xx/wm_ioctl.h b/drivers/staging/gdm72xx/wm_ioctl.h
index ed8f649..066765d 100644
--- a/drivers/staging/gdm72xx/wm_ioctl.h
+++ b/drivers/staging/gdm72xx/wm_ioctl.h
@@ -78,6 +78,11 @@ struct data_s {
void *buf;
};

+struct data_us {
+ int size;
+ void __user *buf;
+};
+
struct wm_req_s {
union {
char ifrn_name[IFNAMSIZ];
@@ -85,6 +90,7 @@ struct wm_req_s {
unsigned short cmd;
unsigned short data_id;
struct data_s data;
+ struct data_us udata;

/* NOTE: sizeof(struct wm_req_s) must be less than sizeof(struct ifreq). */
};
--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/