public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [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

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