kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] tty: cyclades: clean up a type issue
@ 2012-03-02  6:49 Dan Carpenter
  2012-03-02 19:21 ` Jiri Slaby
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2012-03-02  6:49 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, kernel-janitors

Instead of casting value to unsigned long when we use it, we can just
declare it that way at the start.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c
index c9bf779..fbca4ee 100644
--- a/drivers/tty/cyclades.c
+++ b/drivers/tty/cyclades.c
@@ -2397,7 +2397,7 @@ check_and_exit:
  *	    transmit holding register is empty.  This functionality
  *	    allows an RS485 driver to be written in user space.
  */
-static int get_lsr_info(struct cyclades_port *info, unsigned int __user *value)
+static int get_lsr_info(struct cyclades_port *info, unsigned long __user *value)
 {
 	struct cyclades_card *card = info->card;
 	unsigned int result;
@@ -2413,7 +2413,7 @@ static int get_lsr_info(struct cyclades_port *info, unsigned int __user *value)
 		/* Not supported yet */
 		return -EINVAL;
 	}
-	return put_user(result, (unsigned long __user *)value);
+	return put_user(result, value);
 }
 
 static int cy_tiocmget(struct tty_struct *tty)

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [patch] tty: cyclades: clean up a type issue
  2012-03-02  6:49 [patch] tty: cyclades: clean up a type issue Dan Carpenter
@ 2012-03-02 19:21 ` Jiri Slaby
  2012-03-05 18:07   ` [patch v2] tty: cyclades: TIOCSERGETLSR should should store to a uint Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Jiri Slaby @ 2012-03-02 19:21 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Greg Kroah-Hartman, linux-kernel, kernel-janitors

On 03/02/2012 07:49 AM, Dan Carpenter wrote:
> --- a/drivers/tty/cyclades.c
> +++ b/drivers/tty/cyclades.c
...
> @@ -2413,7 +2413,7 @@ static int get_lsr_info(struct cyclades_port *info, unsigned int __user *value)
>  		/* Not supported yet */
>  		return -EINVAL;
>  	}
> -	return put_user(result, (unsigned long __user *)value);
> +	return put_user(result, value);

This was and is wrong BTW. TIOCSERGETLSR should store to uint. Could you
fix that by removing the cast instead, please?

thanks,
-- 
js
suse labs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [patch v2] tty: cyclades: TIOCSERGETLSR should should store to a uint
  2012-03-02 19:21 ` Jiri Slaby
@ 2012-03-05 18:07   ` Dan Carpenter
  2012-03-06 14:09     ` Jiri Slaby
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2012-03-05 18:07 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: Greg Kroah-Hartman, linux-kernel, kernel-janitors

TIOCSERGETLSR should be saved in a uint so the cast here to unsigned
long is a bug.

Reported-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: completely different from v1.

diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c
index c9bf779..5575fee 100644
--- a/drivers/tty/cyclades.c
+++ b/drivers/tty/cyclades.c
@@ -2413,7 +2413,7 @@ static int get_lsr_info(struct cyclades_port *info, unsigned int __user *value)
 		/* Not supported yet */
 		return -EINVAL;
 	}
-	return put_user(result, (unsigned long __user *)value);
+	return put_user(result, value);
 }
 
 static int cy_tiocmget(struct tty_struct *tty)

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [patch v2] tty: cyclades: TIOCSERGETLSR should should store to a uint
  2012-03-05 18:07   ` [patch v2] tty: cyclades: TIOCSERGETLSR should should store to a uint Dan Carpenter
@ 2012-03-06 14:09     ` Jiri Slaby
  0 siblings, 0 replies; 4+ messages in thread
From: Jiri Slaby @ 2012-03-06 14:09 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Greg Kroah-Hartman, linux-kernel, kernel-janitors, Jiri Slaby

On 03/05/2012 07:07 PM, Dan Carpenter wrote:
> TIOCSERGETLSR should be saved in a uint so the cast here to unsigned
> long is a bug.
> 
> Reported-by: Jiri Slaby <jslaby@suse.cz>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

ACK. Thanks.

> ---
> v2: completely different from v1.
> 
> diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c
> index c9bf779..5575fee 100644
> --- a/drivers/tty/cyclades.c
> +++ b/drivers/tty/cyclades.c
> @@ -2413,7 +2413,7 @@ static int get_lsr_info(struct cyclades_port *info, unsigned int __user *value)
>  		/* Not supported yet */
>  		return -EINVAL;
>  	}
> -	return put_user(result, (unsigned long __user *)value);
> +	return put_user(result, value);
>  }
>  
>  static int cy_tiocmget(struct tty_struct *tty)
-- 
js
suse labs

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-03-06 14:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-02  6:49 [patch] tty: cyclades: clean up a type issue Dan Carpenter
2012-03-02 19:21 ` Jiri Slaby
2012-03-05 18:07   ` [patch v2] tty: cyclades: TIOCSERGETLSR should should store to a uint Dan Carpenter
2012-03-06 14:09     ` Jiri Slaby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).