Skip to contentSkip to conversation

watchdog: dw_wdt: Add __user annotation

PATCH Superseded Jingoo Han 3 participants 3 messages Aug 1, 2013 – Oct 26, 2013 Watchdog device drivers

lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

PATCH 1/1 watchdog: dw_wdt: Add __user annotation

Added __user annotation to fix the following sparse warnings.

drivers/watchdog/dw_wdt.c:206:38: warning: incorrect type in argument 1 (different address spaces)
drivers/watchdog/dw_wdt.c:206:38: expected void [noderef] <asn:1>*to
drivers/watchdog/dw_wdt.c:206:38: got struct watchdog_info *<noident>
drivers/watchdog/dw_wdt.c:211:24: warning: incorrect type in initializer (different address spaces)
drivers/watchdog/dw_wdt.c:211:24: expected int const [noderef] <asn:1>*register __p
drivers/watchdog/dw_wdt.c:211:24: got int *<noident>

---
 drivers/watchdog/dw_wdt.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/watchdog/dw_wdt.c +2 -2
index e621098..cd5befb 100644
@@ -203,12 +203,12 @@ static long dw_wdt_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 
 	switch (cmd) {
 	case WDIOC_GETSUPPORT:
-		return copy_to_user((struct watchdog_info *)arg, &dw_wdt_ident,
+		return copy_to_user((void __user *)arg, &dw_wdt_ident,
 				    sizeof(dw_wdt_ident)) ? -EFAULT : 0;
 
 	case WDIOC_GETSTATUS:
 	case WDIOC_GETBOOTSTATUS:
-		return put_user(0, (int *)arg);
+		return put_user(0, (int __user *)arg);
 
 	case WDIOC_KEEPALIVE:
 		dw_wdt_set_next_heartbeat();
Signature · 1 line
1.7.10.4
Acked-by on v1 1/1
#1 lore raw

Hi Jingoo,

Quoted 10 lines · Jingoo Han

Added __user annotation to fix the following sparse warnings.

drivers/watchdog/dw_wdt.c:206:38: warning: incorrect type in argument 1 (different address spaces)
drivers/watchdog/dw_wdt.c:206:38: expected void [noderef] <asn:1>*to
drivers/watchdog/dw_wdt.c:206:38: got struct watchdog_info *<noident>
drivers/watchdog/dw_wdt.c:211:24: warning: incorrect type in initializer (different address spaces)
drivers/watchdog/dw_wdt.c:211:24: expected int const [noderef] <asn:1>*register __p
drivers/watchdog/dw_wdt.c:211:24: got int *<noident>

This looks good to me, thanks.

Quoted 27 lines
---
 drivers/watchdog/dw_wdt.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/watchdog/dw_wdt.c +2 -2
index e621098..cd5befb 100644
@@ -203,12 +203,12 @@ static long dw_wdt_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 
 	switch (cmd) {
 	case WDIOC_GETSUPPORT:
-		return copy_to_user((struct watchdog_info *)arg, &dw_wdt_ident,
+		return copy_to_user((void __user *)arg, &dw_wdt_ident,
 				    sizeof(dw_wdt_ident)) ? -EFAULT : 0;
 
 	case WDIOC_GETSTATUS:
 	case WDIOC_GETBOOTSTATUS:
-		return put_user(0, (int *)arg);
+		return put_user(0, (int __user *)arg);
 
 	case WDIOC_KEEPALIVE:
 		dw_wdt_set_next_heartbeat();
Signature · 1 line
1.7.10.4
#2 lore raw
In reply to Jingoo Han

Hi Jingoo,

Quoted 10 lines

Added __user annotation to fix the following sparse warnings.

drivers/watchdog/dw_wdt.c:206:38: warning: incorrect type in argument 1 (different address spaces)
drivers/watchdog/dw_wdt.c:206:38: expected void [noderef] <asn:1>*to
drivers/watchdog/dw_wdt.c:206:38: got struct watchdog_info *<noident>
drivers/watchdog/dw_wdt.c:211:24: warning: incorrect type in initializer (different address spaces)
drivers/watchdog/dw_wdt.c:211:24: expected int const [noderef] <asn:1>*register __p
drivers/watchdog/dw_wdt.c:211:24: got int *<noident>

Added to linux-watchdog-next.

Kind regards,
Wim.