Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1199480 > unrolled thread

[patch] extcon: signedness bugs break error handling

Started byDan Carpenter <dan.carpenter@oracle.com>
First post2015-08-04 09:50 +0200
Last post2015-08-04 13:00 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [patch] extcon: signedness bugs break error handling Dan Carpenter <dan.carpenter@oracle.com> - 2015-08-04 09:50 +0200
    Re: [patch] extcon: signedness bugs break error handling Roger Quadros <rogerq@ti.com> - 2015-08-04 10:50 +0200
    Re: [patch] extcon: signedness bugs break error handling Chanwoo Choi <cw00.choi@samsung.com> - 2015-08-04 13:00 +0200

#1199480 — [patch] extcon: signedness bugs break error handling

FromDan Carpenter <dan.carpenter@oracle.com>
Date2015-08-04 09:50 +0200
Subject[patch] extcon: signedness bugs break error handling
Message-ID<pTF8Z-41P-7@gated-at.bofh.it>
Unsigned is never less than zero so this error handling won't work.

Fixes: be052cc87745 ('extcon: Fix hang and extcon_get/set_cable_state().')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 8301a72..da2fb6c 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -143,7 +143,7 @@ static int find_cable_id_by_name(struct extcon_dev *edev, const char *name)
 
 static int find_cable_index_by_name(struct extcon_dev *edev, const char *name)
 {
-	unsigned int id;
+	int id;
 
 	if (edev->max_supported == 0)
 		return -EINVAL;
@@ -379,7 +379,7 @@ EXPORT_SYMBOL_GPL(extcon_get_cable_state_);
  */
 int extcon_get_cable_state(struct extcon_dev *edev, const char *cable_name)
 {
-	unsigned int id;
+	int id;
 
 	id = find_cable_id_by_name(edev, cable_name);
 	if (id < 0)
@@ -430,7 +430,7 @@ EXPORT_SYMBOL_GPL(extcon_set_cable_state_);
 int extcon_set_cable_state(struct extcon_dev *edev,
 			const char *cable_name, bool cable_state)
 {
-	unsigned int id;
+	int id;
 
 	id = find_cable_id_by_name(edev, cable_name);
 	if (id < 0)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1199536

FromRoger Quadros <rogerq@ti.com>
Date2015-08-04 10:50 +0200
Message-ID<pTG54-5oC-29@gated-at.bofh.it>
In reply to#1199480
On 04/08/15 10:47, Dan Carpenter wrote:
> Unsigned is never less than zero so this error handling won't work.
> 
> Fixes: be052cc87745 ('extcon: Fix hang and extcon_get/set_cable_state().')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks Dan.

Reviewed-by: Roger Quadros <rogerq@ti.com>

cheers,
-roger

> 
> diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
> index 8301a72..da2fb6c 100644
> --- a/drivers/extcon/extcon.c
> +++ b/drivers/extcon/extcon.c
> @@ -143,7 +143,7 @@ static int find_cable_id_by_name(struct extcon_dev *edev, const char *name)
>  
>  static int find_cable_index_by_name(struct extcon_dev *edev, const char *name)
>  {
> -	unsigned int id;
> +	int id;
>  
>  	if (edev->max_supported == 0)
>  		return -EINVAL;
> @@ -379,7 +379,7 @@ EXPORT_SYMBOL_GPL(extcon_get_cable_state_);
>   */
>  int extcon_get_cable_state(struct extcon_dev *edev, const char *cable_name)
>  {
> -	unsigned int id;
> +	int id;
>  
>  	id = find_cable_id_by_name(edev, cable_name);
>  	if (id < 0)
> @@ -430,7 +430,7 @@ EXPORT_SYMBOL_GPL(extcon_set_cable_state_);
>  int extcon_set_cable_state(struct extcon_dev *edev,
>  			const char *cable_name, bool cable_state)
>  {
> -	unsigned int id;
> +	int id;
>  
>  	id = find_cable_id_by_name(edev, cable_name);
>  	if (id < 0)
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1199654

FromChanwoo Choi <cw00.choi@samsung.com>
Date2015-08-04 13:00 +0200
Message-ID<pTI6S-8hI-7@gated-at.bofh.it>
In reply to#1199480
On 08/04/2015 04:47 PM, Dan Carpenter wrote:
> Unsigned is never less than zero so this error handling won't work.
> 
> Fixes: be052cc87745 ('extcon: Fix hang and extcon_get/set_cable_state().')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
> index 8301a72..da2fb6c 100644
> --- a/drivers/extcon/extcon.c
> +++ b/drivers/extcon/extcon.c
> @@ -143,7 +143,7 @@ static int find_cable_id_by_name(struct extcon_dev *edev, const char *name)
>  

Applied it. 

Thanks,
Chanwoo Choi

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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web