Re: [PATCH] staging: crystalhd: Do not mix integers and user pointers

2014-06-20 Thread Greg Kroah-Hartman
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] *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] *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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] staging: crystalhd: Do not mix integers and user pointers

2014-06-20 Thread Dan Carpenter
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] *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] *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

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


[PATCH] staging: crystalhd: Do not mix integers and user pointers

2014-06-20 Thread 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] *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] *ua

Done for the Eudyptula challenge.

Signed-off-by: Lubomir Rintel 
---
 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

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


[PATCH] staging: crystalhd: Do not mix integers and user pointers

2014-06-20 Thread 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 lkund...@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

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


Re: [PATCH] staging: crystalhd: Do not mix integers and user pointers

2014-06-20 Thread Dan Carpenter
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

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


Re: [PATCH] staging: crystalhd: Do not mix integers and user pointers

2014-06-20 Thread Greg Kroah-Hartman
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
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/