* [PATCH] staging: crystalhd: Do not mix integers and user pointers
@ 2014-06-20 11:16 Lubomir Rintel
2014-06-20 11:34 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Lubomir Rintel @ 2014-06-20 11:16 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: devel, linux-kernel, Lubomir Rintel
Fixes the following sparse warnings:
crystalhd/crystalhd_lnx.c:227:61: warning: incorrect type in argument 3 (different base types)
crystalhd/crystalhd_lnx.c:227:61: expected unsigned long [unsigned] ua
crystalhd/crystalhd_lnx.c:227:61: got void [noderef] <asn:1>*ua
crystalhd/crystalhd_lnx.c:229:65: warning: incorrect type in argument 4 (different base types)
crystalhd/crystalhd_lnx.c:229:65: expected unsigned long [unsigned] ua
crystalhd/crystalhd_lnx.c:229:65: got void [noderef] <asn:1>*ua
Done for the Eudyptula challenge.
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
drivers/staging/crystalhd/crystalhd_lnx.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/crystalhd/crystalhd_lnx.c b/drivers/staging/crystalhd/crystalhd_lnx.c
index e6fb331..b2d3ec6 100644
--- a/drivers/staging/crystalhd/crystalhd_lnx.c
+++ b/drivers/staging/crystalhd/crystalhd_lnx.c
@@ -136,9 +136,9 @@ static inline int crystalhd_user_data(void __user *ud, void *dr,
static int chd_dec_fetch_cdata(struct crystalhd_adp *adp,
struct crystalhd_ioctl_data *io, uint32_t m_sz,
- unsigned long ua)
+ void __user *ua)
{
- unsigned long ua_off;
+ void __user *ua_off;
int rc = 0;
if (!adp || !io || !ua || !m_sz) {
@@ -157,8 +157,8 @@ static int chd_dec_fetch_cdata(struct crystalhd_adp *adp,
rc = crystalhd_user_data((void __user *)ua_off, io->add_cdata,
io->add_cdata_sz, 0);
if (rc) {
- BCMLOG_ERR("failed to pull add_cdata sz:%x ua_off:%x\n",
- io->add_cdata_sz, (unsigned int)ua_off);
+ BCMLOG_ERR("failed to pull add_cdata sz:%x ua_off:%p\n",
+ io->add_cdata_sz, ua_off);
vfree(io->add_cdata);
io->add_cdata = NULL;
return -ENODATA;
@@ -169,9 +169,9 @@ static int chd_dec_fetch_cdata(struct crystalhd_adp *adp,
static int chd_dec_release_cdata(struct crystalhd_adp *adp,
struct crystalhd_ioctl_data *io,
- unsigned long ua)
+ void __user *ua)
{
- unsigned long ua_off;
+ void __user *ua_off;
int rc;
if (!adp || !io || !ua) {
@@ -185,8 +185,8 @@ static int chd_dec_release_cdata(struct crystalhd_adp *adp,
io->add_cdata_sz, 1);
if (rc) {
BCMLOG_ERR(
- "failed to push add_cdata sz:%x ua_off:%x\n",
- io->add_cdata_sz, (unsigned int)ua_off);
+ "failed to push add_cdata sz:%x ua_off:%p\n",
+ io->add_cdata_sz, ua_off);
return -ENODATA;
}
}
@@ -201,7 +201,7 @@ static int chd_dec_release_cdata(struct crystalhd_adp *adp,
static int chd_dec_proc_user_data(struct crystalhd_adp *adp,
struct crystalhd_ioctl_data *io,
- unsigned long ua, int set)
+ void __user *ua, int set)
{
int rc;
uint32_t m_sz = 0;
@@ -235,7 +235,7 @@ static int chd_dec_proc_user_data(struct crystalhd_adp *adp,
return rc;
}
-static int chd_dec_api_cmd(struct crystalhd_adp *adp, unsigned long ua,
+static int chd_dec_api_cmd(struct crystalhd_adp *adp, void __user *ua,
uint32_t uid, uint32_t cmd, crystalhd_cmd_proc func)
{
int rc;
@@ -266,12 +266,14 @@ static int chd_dec_api_cmd(struct crystalhd_adp *adp, unsigned long ua,
}
/* API interfaces */
-static long chd_dec_ioctl(struct file *fd, unsigned int cmd, unsigned long ua)
+static long chd_dec_ioctl(struct file *fd, unsigned int cmd,
+ unsigned long __ua)
{
struct crystalhd_adp *adp = chd_get_adp();
crystalhd_cmd_proc cproc;
struct crystalhd_user *uc;
int ret;
+ void __user *ua = (void __user *)__ua;
if (!adp || !fd) {
BCMLOG_ERR("Invalid adp\n");
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] staging: crystalhd: Do not mix integers and user pointers
2014-06-20 11:16 [PATCH] staging: crystalhd: Do not mix integers and user pointers Lubomir Rintel
@ 2014-06-20 11:34 ` Dan Carpenter
2014-06-20 15:14 ` Greg Kroah-Hartman
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2014-06-20 11:34 UTC (permalink / raw)
To: Lubomir Rintel; +Cc: Greg Kroah-Hartman, devel, linux-kernel
On Fri, Jun 20, 2014 at 01:16:17PM +0200, Lubomir Rintel wrote:
> Fixes the following sparse warnings:
>
> crystalhd/crystalhd_lnx.c:227:61: warning: incorrect type in argument 3 (different base types)
> crystalhd/crystalhd_lnx.c:227:61: expected unsigned long [unsigned] ua
> crystalhd/crystalhd_lnx.c:227:61: got void [noderef] <asn:1>*ua
> crystalhd/crystalhd_lnx.c:229:65: warning: incorrect type in argument 4 (different base types)
> crystalhd/crystalhd_lnx.c:229:65: expected unsigned long [unsigned] ua
> crystalhd/crystalhd_lnx.c:229:65: got void [noderef] <asn:1>*ua
>
> Done for the Eudyptula challenge.
>
This patch is nice and fixes a bunch of warnings.
Normally, I would might you to redo it and remove the no longer needed
casts for ua_off as well...
crystalhd_user_data((void __user *)ua_off, io->add_cdata,
^^^^^^^^^^^^^^^
But we are going to delete this entire driver soon. We may as well
apply yours as is and then delete it or just delete the driver without
applying this cleanup.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] staging: crystalhd: Do not mix integers and user pointers
2014-06-20 11:34 ` Dan Carpenter
@ 2014-06-20 15:14 ` Greg Kroah-Hartman
0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2014-06-20 15:14 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Lubomir Rintel, devel, linux-kernel
On Fri, Jun 20, 2014 at 02:34:26PM +0300, Dan Carpenter wrote:
> On Fri, Jun 20, 2014 at 01:16:17PM +0200, Lubomir Rintel wrote:
> > Fixes the following sparse warnings:
> >
> > crystalhd/crystalhd_lnx.c:227:61: warning: incorrect type in argument 3 (different base types)
> > crystalhd/crystalhd_lnx.c:227:61: expected unsigned long [unsigned] ua
> > crystalhd/crystalhd_lnx.c:227:61: got void [noderef] <asn:1>*ua
> > crystalhd/crystalhd_lnx.c:229:65: warning: incorrect type in argument 4 (different base types)
> > crystalhd/crystalhd_lnx.c:229:65: expected unsigned long [unsigned] ua
> > crystalhd/crystalhd_lnx.c:229:65: got void [noderef] <asn:1>*ua
> >
> > Done for the Eudyptula challenge.
> >
>
> This patch is nice and fixes a bunch of warnings.
>
> Normally, I would might you to redo it and remove the no longer needed
> casts for ua_off as well...
>
> crystalhd_user_data((void __user *)ua_off, io->add_cdata,
> ^^^^^^^^^^^^^^^
> But we are going to delete this entire driver soon. We may as well
> apply yours as is and then delete it or just delete the driver without
> applying this cleanup.
Yeah, I'm just going to go delete this driver right now, so I will not
apply this patch, sorry :(
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-06-20 15:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-20 11:16 [PATCH] staging: crystalhd: Do not mix integers and user pointers Lubomir Rintel
2014-06-20 11:34 ` Dan Carpenter
2014-06-20 15:14 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox