Skip to contentSkip to conversation

tty: cyclades: clean up a type issue

PATCH In review Dan Carpenter 2 participants 4 messages Mar 2, 2012 – Mar 6, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tty: cyclades: clean up a type issue

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

drivers/tty/cyclades.c +2 -2
index c9bf779..fbca4ee 100644
@@ -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)
#1 lore raw
Quoted 2 lines · Dan Carpenter
drivers/tty/cyclades.c +0 -0

...

drivers/tty/cyclades.c static int get_lsr_info(struct cyclades_port *info, unsigned int __user *value) · line 2416

Quoted 6 lines
drivers/tty/cyclades.c +1 -1
@@ -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,

Signature · 2 lines
js
suse labs
#2 lore raw

PATCH v2 1/1 tty: cyclades: TIOCSERGETLSR should should store to a uint

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

---
v2: completely different from v1.

drivers/tty/cyclades.c +1 -1
index c9bf779..5575fee 100644
@@ -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)
#3 lore raw

Re: [patch v2] tty: cyclades: TIOCSERGETLSR should should store to a uint

Quoted 5 lines · Dan Carpenter

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

ACK. Thanks.

Quoted 16 lines

---
v2: completely different from v1.

drivers/tty/cyclades.c +1 -1
index c9bf779..5575fee 100644
@@ -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)
Signature · 2 lines
js
suse labs