Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1281776 > unrolled thread
| Started by | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| First post | 2015-12-02 14:20 +0100 |
| Last post | 2015-12-11 19:20 +0100 |
| Articles | 5 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH] staging: gdm72xx: fix address space parse warnings Dan Carpenter <dan.carpenter@oracle.com> - 2015-12-02 14:20 +0100
Re: [PATCH] staging: gdm72xx: fix address space parse warnings Okash Khawaja <okash.khawaja@gmail.com> - 2015-12-11 11:40 +0100
Re: [PATCH] staging: gdm72xx: fix address space parse warnings Dan Carpenter <dan.carpenter@oracle.com> - 2015-12-11 12:00 +0100
Re: [PATCH] staging: gdm72xx: fix address space parse warnings Okash Khawaja <okash.khawaja@gmail.com> - 2015-12-11 12:20 +0100
[PATCH v2] staging: gdm72xx: fix address space warnings Okash Khawaja <okash.khawaja@gmail.com> - 2015-12-11 19:20 +0100
| From | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| Date | 2015-12-02 14:20 +0100 |
| Subject | Re: [PATCH] staging: gdm72xx: fix address space parse warnings |
| Message-ID | <qBfua-7Ey-17@gated-at.bofh.it> |
Probably it's better to create a different struct:
struct udata_s {
unsigned int size;
void __user *buf;
};
regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Okash Khawaja <okash.khawaja@gmail.com> |
|---|---|
| Date | 2015-12-11 11:40 +0100 |
| Message-ID | <qEthf-311-7@gated-at.bofh.it> |
| In reply to | #1281776 |
Thanks, that's a cleaner approach. Apologies for delayed reply as I'm in middle of a house move. I'll send an updated patch soon.
Okash
> On 2 Dec 2015, at 13:17, Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> Probably it's better to create a different struct:
>
> struct udata_s {
> unsigned int size;
> void __user *buf;
> };
>
> regards,
> dan carpenter
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| Date | 2015-12-11 12:00 +0100 |
| Message-ID | <qEtAC-38W-1@gated-at.bofh.it> |
| In reply to | #1289401 |
On Fri, Dec 11, 2015 at 10:33:13AM +0000, Okash Khawaja wrote: > Thanks, that's a cleaner approach. Apologies for delayed reply as I'm in middle of a house move. I'll send an updated patch soon. > Someone already fixed it. Thanks. regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Okash Khawaja <okash.khawaja@gmail.com> |
|---|---|
| Date | 2015-12-11 12:20 +0100 |
| Message-ID | <qEtTX-3va-7@gated-at.bofh.it> |
| In reply to | #1289424 |
> On 11 Dec 2015, at 10:52, Dan Carpenter <dan.carpenter@oracle.com> wrote: > >> On Fri, Dec 11, 2015 at 10:33:13AM +0000, Okash Khawaja wrote: >> Thanks, that's a cleaner approach. Apologies for delayed reply as I'm in middle of a house move. I'll send an updated patch soon. > > Someone already fixed it. Thanks. > > regards, > dan carpenter > It seems like it's still there: https://kernel.googlesource.com/pub/scm/linux/kernel/git/gregkh/staging/+/staging-next/drivers/staging/gdm72xx/gdm_wimax.c Am I looking in the wrong place? Thanks, Okash-- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Okash Khawaja <okash.khawaja@gmail.com> |
|---|---|
| Date | 2015-12-11 19:20 +0100 |
| Subject | [PATCH v2] staging: gdm72xx: fix address space warnings |
| Message-ID | <qEAsp-81R-9@gated-at.bofh.it> |
| In reply to | #1281776 |
copy_to_user() and copy_from_user() functions expect the user space
pointers to be marked with __user. Sparse throws following warnings.
For copy_to_user():
warning: incorrect type in argument 1 (different address spaces)
expected void [noderef] <asn:1>*to
got void *buf
For copy_from_user():
warning: incorrect type in argument 2 (different address spaces)
expected void const [noderef] <asn:1>*from
got void *buf
This creates a separate `struct udata_s` which is user space counterpart
of `struct data_s`. This patch also alters function signatures where
data transfer between user and kernel space occurs, in order to make the
distinction explicit. Finally, it explicitly casts the argument passed
to `gdm_update_fsm()` using __force to avoid the warning "cast removes
address space of expression".
Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com>
---
drivers/staging/gdm72xx/gdm_wimax.c | 7 ++++---
drivers/staging/gdm72xx/wm_ioctl.h | 7 ++++++-
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..c61ce92 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 udata_s *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 udata_s *src)
{
if (!src->size) {
dst->size = 0;
@@ -478,7 +478,8 @@ static int gdm_wimax_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
* before gdm_wimax_ioctl_set_data is called.
*/
gdm_update_fsm(dev,
- req->data.buf);
+ (__force struct fsm_s *)
+ req->data.buf);
}
ret = gdm_wimax_ioctl_set_data(
&nic->sdk_data[req->data_id], &req->data);
diff --git a/drivers/staging/gdm72xx/wm_ioctl.h b/drivers/staging/gdm72xx/wm_ioctl.h
index ed8f649..7dc8f6f 100644
--- a/drivers/staging/gdm72xx/wm_ioctl.h
+++ b/drivers/staging/gdm72xx/wm_ioctl.h
@@ -78,13 +78,18 @@ struct data_s {
void *buf;
};
+struct udata_s {
+ unsigned int size;
+ void __user *buf;
+};
+
struct wm_req_s {
union {
char ifrn_name[IFNAMSIZ];
} ifr_ifrn;
unsigned short cmd;
unsigned short data_id;
- struct data_s data;
+ struct udata_s data;
/* NOTE: sizeof(struct wm_req_s) must be less than sizeof(struct ifreq). */
};
--
2.5.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web