All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/14] Modify signed comparisons of unsigned variables
@ 2012-11-16  6:50 Tushar Behera
  2012-11-16  6:50 ` [PATCH 01/14] [media] ivtv: Remove redundant check on unsigned variable Tushar Behera
                   ` (14 more replies)
  0 siblings, 15 replies; 44+ messages in thread
From: Tushar Behera @ 2012-11-16  6:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: patches, Mauro Carvalho Chehab, Linus Walleij, Ian Campbell,
	Konrad Rzeszutek Wilk, Jeremy Fitzhardinge, Chas Williams,
	Jack Steiner, Arnd Bergmann, Luciano Coelho, Jiri Kosina,
	ivtv-devel, linux-media, xen-devel, netdev, virtualization,
	linux-atm-general, linux-usb, linux-input, linux-wireless

The occurrences were identified through the coccinelle script at
following location.

http://www.emn.fr/z-info/coccinelle/rules/find_unsigned.cocci

Signed checks for unsigned variables are removed if it is also checked
for upper error limit. For error checks, IS_ERR_VALUE() macros is used.

Tushar Behera (14):
  [media] ivtv: Remove redundant check on unsigned variable
  [media] meye: Remove redundant check on unsigned variable
  [media] saa7134: Remove redundant check on unsigned variable
  [media] tlg2300: Remove redundant check on unsigned variable
  [media] atmel-isi: Update error check for unsigned variables
  pinctrl: samsung: Update error check for unsigned variables
  pinctrl: SPEAr: Update error check for unsigned variables
  xen: netback: Remove redundant check on unsigned variable
  xen: events: Remove redundant check on unsigned variable
  atm: Removed redundant check on unsigned variable
  HID: hiddev: Remove redundant check on unsigned variable
  gru: Remove redundant check on unsigned variable
  misc: tsl2550: Remove redundant check on unsigned variable
  wlcore: Remove redundant check on unsigned variable

 drivers/atm/fore200e.c                        |    2 +-
 drivers/hid/usbhid/hiddev.c                   |    2 +-
 drivers/media/pci/ivtv/ivtv-ioctl.c           |    2 +-
 drivers/media/pci/meye/meye.c                 |    2 +-
 drivers/media/pci/saa7134/saa7134-video.c     |    2 +-
 drivers/media/platform/soc_camera/atmel-isi.c |    2 +-
 drivers/media/usb/tlg2300/pd-video.c          |    2 +-
 drivers/misc/sgi-gru/grukdump.c               |    2 +-
 drivers/misc/tsl2550.c                        |    4 ++--
 drivers/net/wireless/ti/wlcore/debugfs.c      |    2 +-
 drivers/net/xen-netback/netback.c             |    4 ++--
 drivers/pinctrl/pinctrl-samsung.c             |    2 +-
 drivers/pinctrl/spear/pinctrl-plgpio.c        |    2 +-
 drivers/xen/events.c                          |    2 +-
 14 files changed, 16 insertions(+), 16 deletions(-)

-- 
1.7.4.1

CC: Mauro Carvalho Chehab <mchehab@infradead.org>
CC: Linus Walleij <linus.walleij@linaro.org>
CC: Ian Campbell <ian.campbell@citrix.com>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: Jeremy Fitzhardinge <jeremy@goop.org>
CC: Chas Williams <chas@cmf.nrl.navy.mil>
CC: Jack Steiner <steiner@sgi.com>
CC: Arnd Bergmann <arnd@arndb.de>
CC: Luciano Coelho <coelho@ti.com>
CC: Jiri Kosina <jkosina@suse.cz>
CC: ivtv-devel@ivtvdriver.org
CC: linux-media@vger.kernel.org
CC: xen-devel@lists.xensource.com
CC: netdev@vger.kernel.org
CC: virtualization@lists.linux-foundation.org
CC: linux-atm-general@lists.sourceforge.net
CC: linux-usb@vger.kernel.org
CC: linux-input@vger.kernel.org
CC: linux-wireless@vger.kernel.org

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

* [PATCH 01/14] [media] ivtv: Remove redundant check on unsigned variable
  2012-11-16  6:50 [PATCH 00/14] Modify signed comparisons of unsigned variables Tushar Behera
@ 2012-11-16  6:50 ` Tushar Behera
  2012-11-16  6:50 ` [PATCH 02/14] [media] meye: " Tushar Behera
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 44+ messages in thread
From: Tushar Behera @ 2012-11-16  6:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: patches, Mauro Carvalho Chehab, ivtv-devel, linux-media

No need to check whether unsigned variable is less than 0.

CC: Mauro Carvalho Chehab <mchehab@infradead.org>
CC: ivtv-devel@ivtvdriver.org
CC: linux-media@vger.kernel.org
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 drivers/media/pci/ivtv/ivtv-ioctl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.c b/drivers/media/pci/ivtv/ivtv-ioctl.c
index 949ae23..4b47b5c 100644
--- a/drivers/media/pci/ivtv/ivtv-ioctl.c
+++ b/drivers/media/pci/ivtv/ivtv-ioctl.c
@@ -993,7 +993,7 @@ int ivtv_s_input(struct file *file, void *fh, unsigned int inp)
 	v4l2_std_id std;
 	int i;
 
-	if (inp < 0 || inp >= itv->nof_inputs)
+	if (inp >= itv->nof_inputs)
 		return -EINVAL;
 
 	if (inp == itv->active_input) {
-- 
1.7.4.1


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

* [PATCH 02/14] [media] meye: Remove redundant check on unsigned variable
  2012-11-16  6:50 [PATCH 00/14] Modify signed comparisons of unsigned variables Tushar Behera
  2012-11-16  6:50 ` [PATCH 01/14] [media] ivtv: Remove redundant check on unsigned variable Tushar Behera
@ 2012-11-16  6:50 ` Tushar Behera
  2012-11-16  6:50 ` [PATCH 03/14] [media] saa7134: " Tushar Behera
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 44+ messages in thread
From: Tushar Behera @ 2012-11-16  6:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: patches, Mauro Carvalho Chehab, linux-media

No need to check whether unsigned variable is less than 0.

CC: Mauro Carvalho Chehab <mchehab@infradead.org>
CC: linux-media@vger.kernel.org
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 drivers/media/pci/meye/meye.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/pci/meye/meye.c b/drivers/media/pci/meye/meye.c
index e5a76da..ae7d320 100644
--- a/drivers/media/pci/meye/meye.c
+++ b/drivers/media/pci/meye/meye.c
@@ -1945,7 +1945,7 @@ static struct pci_driver meye_driver = {
 static int __init meye_init(void)
 {
 	gbuffers = max(2, min((int)gbuffers, MEYE_MAX_BUFNBRS));
-	if (gbufsize < 0 || gbufsize > MEYE_MAX_BUFSIZE)
+	if (gbufsize > MEYE_MAX_BUFSIZE)
 		gbufsize = MEYE_MAX_BUFSIZE;
 	gbufsize = PAGE_ALIGN(gbufsize);
 	printk(KERN_INFO "meye: using %d buffers with %dk (%dk total) "
-- 
1.7.4.1


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

* [PATCH 03/14] [media] saa7134: Remove redundant check on unsigned variable
  2012-11-16  6:50 [PATCH 00/14] Modify signed comparisons of unsigned variables Tushar Behera
  2012-11-16  6:50 ` [PATCH 01/14] [media] ivtv: Remove redundant check on unsigned variable Tushar Behera
  2012-11-16  6:50 ` [PATCH 02/14] [media] meye: " Tushar Behera
@ 2012-11-16  6:50 ` Tushar Behera
  2012-11-16  6:50 ` [PATCH 04/14] [media] tlg2300: " Tushar Behera
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 44+ messages in thread
From: Tushar Behera @ 2012-11-16  6:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: patches, Mauro Carvalho Chehab, linux-media

No need to check whether the unsigned variable is less than 0.

CC: Mauro Carvalho Chehab <mchehab@infradead.org>
CC: linux-media@vger.kernel.org
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 drivers/media/pci/saa7134/saa7134-video.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/pci/saa7134/saa7134-video.c b/drivers/media/pci/saa7134/saa7134-video.c
index 4a77124..3abf527 100644
--- a/drivers/media/pci/saa7134/saa7134-video.c
+++ b/drivers/media/pci/saa7134/saa7134-video.c
@@ -2511,7 +2511,7 @@ int saa7134_video_init1(struct saa7134_dev *dev)
 	/* sanitycheck insmod options */
 	if (gbuffers < 2 || gbuffers > VIDEO_MAX_FRAME)
 		gbuffers = 2;
-	if (gbufsize < 0 || gbufsize > gbufsize_max)
+	if (gbufsize > gbufsize_max)
 		gbufsize = gbufsize_max;
 	gbufsize = (gbufsize + PAGE_SIZE - 1) & PAGE_MASK;
 
-- 
1.7.4.1


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

* [PATCH 04/14] [media] tlg2300: Remove redundant check on unsigned variable
  2012-11-16  6:50 [PATCH 00/14] Modify signed comparisons of unsigned variables Tushar Behera
                   ` (2 preceding siblings ...)
  2012-11-16  6:50 ` [PATCH 03/14] [media] saa7134: " Tushar Behera
@ 2012-11-16  6:50 ` Tushar Behera
  2012-11-16  6:50 ` [PATCH 05/14] [media] atmel-isi: Update error check for unsigned variables Tushar Behera
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 44+ messages in thread
From: Tushar Behera @ 2012-11-16  6:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: patches, Mauro Carvalho Chehab, linux-media

No need to check whether unsigned variable is less than 0.

CC: Mauro Carvalho Chehab <mchehab@infradead.org>
CC: linux-media@vger.kernel.org
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 drivers/media/usb/tlg2300/pd-video.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/usb/tlg2300/pd-video.c b/drivers/media/usb/tlg2300/pd-video.c
index 1f448ac..dd157e7 100644
--- a/drivers/media/usb/tlg2300/pd-video.c
+++ b/drivers/media/usb/tlg2300/pd-video.c
@@ -923,7 +923,7 @@ static int vidioc_s_input(struct file *file, void *fh, unsigned int i)
 	struct poseidon *pd = front->pd;
 	s32 ret, cmd_status;
 
-	if (i < 0 || i >= POSEIDON_INPUTS)
+	if (i >= POSEIDON_INPUTS)
 		return -EINVAL;
 	ret = send_set_req(pd, SGNL_SRC_SEL,
 			pd_inputs[i].tlg_src, &cmd_status);
-- 
1.7.4.1


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

* [PATCH 05/14] [media] atmel-isi: Update error check for unsigned variables
  2012-11-16  6:50 [PATCH 00/14] Modify signed comparisons of unsigned variables Tushar Behera
                   ` (3 preceding siblings ...)
  2012-11-16  6:50 ` [PATCH 04/14] [media] tlg2300: " Tushar Behera
@ 2012-11-16  6:50 ` Tushar Behera
  2012-11-17 23:16   ` Guennadi Liakhovetski
  2012-11-16  6:50 ` [PATCH 06/14] pinctrl: samsung: " Tushar Behera
                   ` (9 subsequent siblings)
  14 siblings, 1 reply; 44+ messages in thread
From: Tushar Behera @ 2012-11-16  6:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: patches, Mauro Carvalho Chehab, linux-media

Checking '< 0' for unsigned variables always returns false. For error
codes, use IS_ERR_VALUE() instead.

CC: Mauro Carvalho Chehab <mchehab@infradead.org>
CC: linux-media@vger.kernel.org
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 drivers/media/platform/soc_camera/atmel-isi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c
index 6274a91..5bd65df 100644
--- a/drivers/media/platform/soc_camera/atmel-isi.c
+++ b/drivers/media/platform/soc_camera/atmel-isi.c
@@ -1020,7 +1020,7 @@ static int __devinit atmel_isi_probe(struct platform_device *pdev)
 	isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS);
 
 	irq = platform_get_irq(pdev, 0);
-	if (irq < 0) {
+	if (IS_ERR_VALUE(irq)) {
 		ret = irq;
 		goto err_req_irq;
 	}
-- 
1.7.4.1


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

* [PATCH 06/14] pinctrl: samsung: Update error check for unsigned variables
  2012-11-16  6:50 [PATCH 00/14] Modify signed comparisons of unsigned variables Tushar Behera
                   ` (4 preceding siblings ...)
  2012-11-16  6:50 ` [PATCH 05/14] [media] atmel-isi: Update error check for unsigned variables Tushar Behera
@ 2012-11-16  6:50 ` Tushar Behera
  2012-11-17 20:31   ` Linus Walleij
  2012-11-16  6:50 ` [PATCH 07/14] pinctrl: SPEAr: " Tushar Behera
                   ` (8 subsequent siblings)
  14 siblings, 1 reply; 44+ messages in thread
From: Tushar Behera @ 2012-11-16  6:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: patches, Linus Walleij

Checking '< 0' for unsigned variables always returns false. For error
codes, use IS_ERR_VALUE() instead.

CC: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 drivers/pinctrl/pinctrl-samsung.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-samsung.c b/drivers/pinctrl/pinctrl-samsung.c
index 81c9896..3b52c17 100644
--- a/drivers/pinctrl/pinctrl-samsung.c
+++ b/drivers/pinctrl/pinctrl-samsung.c
@@ -560,7 +560,7 @@ static int __devinit samsung_pinctrl_parse_dt_pins(struct platform_device *pdev,
 	const char *pin_name;
 
 	*npins = of_property_count_strings(cfg_np, "samsung,pins");
-	if (*npins < 0) {
+	if (IS_ERR_VALUE(*npins)) {
 		dev_err(dev, "invalid pin list in %s node", cfg_np->name);
 		return -EINVAL;
 	}
-- 
1.7.4.1


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

* [PATCH 07/14] pinctrl: SPEAr: Update error check for unsigned variables
  2012-11-16  6:50 [PATCH 00/14] Modify signed comparisons of unsigned variables Tushar Behera
                   ` (5 preceding siblings ...)
  2012-11-16  6:50 ` [PATCH 06/14] pinctrl: samsung: " Tushar Behera
@ 2012-11-16  6:50 ` Tushar Behera
  2012-11-16  7:05   ` viresh kumar
  2012-11-23  7:34   ` Linus Walleij
  2012-11-16  6:50 ` [PATCH 08/14] xen: netback: Remove redundant check on unsigned variable Tushar Behera
                   ` (7 subsequent siblings)
  14 siblings, 2 replies; 44+ messages in thread
From: Tushar Behera @ 2012-11-16  6:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: patches, Linus Walleij

Checking '< 0' for unsigned variables always returns false. For error
codes, use IS_ERR_VALUE() instead.

CC: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 drivers/pinctrl/spear/pinctrl-plgpio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/pinctrl/spear/pinctrl-plgpio.c b/drivers/pinctrl/spear/pinctrl-plgpio.c
index 1044ad3..9e0c731 100644
--- a/drivers/pinctrl/spear/pinctrl-plgpio.c
+++ b/drivers/pinctrl/spear/pinctrl-plgpio.c
@@ -283,7 +283,7 @@ static int plgpio_to_irq(struct gpio_chip *chip, unsigned offset)
 {
 	struct plgpio *plgpio = container_of(chip, struct plgpio, chip);
 
-	if (plgpio->irq_base < 0)
+	if (IS_ERR_VALUE(plgpio->irq_base))
 		return -EINVAL;
 
 	return irq_find_mapping(plgpio->irq_domain, offset);
-- 
1.7.4.1


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

* [PATCH 08/14] xen: netback: Remove redundant check on unsigned variable
  2012-11-16  6:50 [PATCH 00/14] Modify signed comparisons of unsigned variables Tushar Behera
                   ` (6 preceding siblings ...)
  2012-11-16  6:50 ` [PATCH 07/14] pinctrl: SPEAr: " Tushar Behera
@ 2012-11-16  6:50 ` Tushar Behera
  2012-11-16  9:16   ` Ian Campbell
  2012-11-16  6:50 ` [PATCH 09/14] xen: events: " Tushar Behera
                   ` (6 subsequent siblings)
  14 siblings, 1 reply; 44+ messages in thread
From: Tushar Behera @ 2012-11-16  6:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: patches, Ian Campbell, xen-devel, netdev

No need to check whether unsigned variable is less than 0.

CC: Ian Campbell <ian.campbell@citrix.com>
CC: xen-devel@lists.xensource.com
CC: netdev@vger.kernel.org
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 drivers/net/xen-netback/netback.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index aab8677..515e10c 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -190,14 +190,14 @@ static int get_page_ext(struct page *pg,
 
 	group = ext.e.group - 1;
 
-	if (group < 0 || group >= xen_netbk_group_nr)
+	if (group >= xen_netbk_group_nr)
 		return 0;
 
 	netbk = &xen_netbk[group];
 
 	idx = ext.e.idx;
 
-	if ((idx < 0) || (idx >= MAX_PENDING_REQS))
+	if (idx >= MAX_PENDING_REQS)
 		return 0;
 
 	if (netbk->mmap_pages[idx] != pg)
-- 
1.7.4.1


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

* [PATCH 09/14] xen: events: Remove redundant check on unsigned variable
  2012-11-16  6:50 [PATCH 00/14] Modify signed comparisons of unsigned variables Tushar Behera
                   ` (7 preceding siblings ...)
  2012-11-16  6:50 ` [PATCH 08/14] xen: netback: Remove redundant check on unsigned variable Tushar Behera
@ 2012-11-16  6:50 ` Tushar Behera
  2012-11-16 16:09     ` Konrad Rzeszutek Wilk
  2012-11-16  6:50 ` Tushar Behera
                   ` (5 subsequent siblings)
  14 siblings, 1 reply; 44+ messages in thread
From: Tushar Behera @ 2012-11-16  6:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: patches, Konrad Rzeszutek Wilk, Jeremy Fitzhardinge, xen-devel,
	virtualization

No need to check whether unsigned variable is less than 0.

CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: Jeremy Fitzhardinge <jeremy@goop.org>
CC: xen-devel@lists.xensource.com
CC: virtualization@lists.linux-foundation.org
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 drivers/xen/events.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index 4293c57..cadd7d1 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -216,7 +216,7 @@ static void xen_irq_info_pirq_init(unsigned irq,
  */
 static unsigned int evtchn_from_irq(unsigned irq)
 {
-	if (unlikely(WARN(irq < 0 || irq >= nr_irqs, "Invalid irq %d!\n", irq)))
+	if (unlikely(WARN(irq >= nr_irqs, "Invalid irq %d!\n", irq)))
 		return 0;
 
 	return info_for_irq(irq)->evtchn;
-- 
1.7.4.1


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

* [PATCH 09/14] xen: events: Remove redundant check on unsigned variable
  2012-11-16  6:50 [PATCH 00/14] Modify signed comparisons of unsigned variables Tushar Behera
                   ` (8 preceding siblings ...)
  2012-11-16  6:50 ` [PATCH 09/14] xen: events: " Tushar Behera
@ 2012-11-16  6:50 ` Tushar Behera
  2012-11-16  6:50 ` [PATCH 10/14] atm: Removed " Tushar Behera
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 44+ messages in thread
From: Tushar Behera @ 2012-11-16  6:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jeremy Fitzhardinge, Konrad Rzeszutek Wilk, virtualization,
	xen-devel, patches

No need to check whether unsigned variable is less than 0.

CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: Jeremy Fitzhardinge <jeremy@goop.org>
CC: xen-devel@lists.xensource.com
CC: virtualization@lists.linux-foundation.org
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 drivers/xen/events.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index 4293c57..cadd7d1 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -216,7 +216,7 @@ static void xen_irq_info_pirq_init(unsigned irq,
  */
 static unsigned int evtchn_from_irq(unsigned irq)
 {
-	if (unlikely(WARN(irq < 0 || irq >= nr_irqs, "Invalid irq %d!\n", irq)))
+	if (unlikely(WARN(irq >= nr_irqs, "Invalid irq %d!\n", irq)))
 		return 0;
 
 	return info_for_irq(irq)->evtchn;
-- 
1.7.4.1

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

* [PATCH 10/14] atm: Removed redundant check on unsigned variable
  2012-11-16  6:50 [PATCH 00/14] Modify signed comparisons of unsigned variables Tushar Behera
                   ` (9 preceding siblings ...)
  2012-11-16  6:50 ` Tushar Behera
@ 2012-11-16  6:50 ` Tushar Behera
  2012-12-28  5:16   ` Tushar Behera
  2012-11-16  6:50 ` [PATCH 11/14] HID: hiddev: Remove " Tushar Behera
                   ` (3 subsequent siblings)
  14 siblings, 1 reply; 44+ messages in thread
From: Tushar Behera @ 2012-11-16  6:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: patches, Chas Williams, linux-atm-general, netdev

No need to check whether unsigned variable is less than 0.

CC: Chas Williams <chas@cmf.nrl.navy.mil>
CC: linux-atm-general@lists.sourceforge.net
CC: netdev@vger.kernel.org
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 drivers/atm/fore200e.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
index 361f5ae..fdd3fe7 100644
--- a/drivers/atm/fore200e.c
+++ b/drivers/atm/fore200e.c
@@ -972,7 +972,7 @@ int bsq_audit(int where, struct host_bsq* bsq, int scheme, int magn)
 		   where, scheme, magn, buffer->index, buffer->scheme);
 	}
 
-	if ((buffer->index < 0) || (buffer->index >= fore200e_rx_buf_nbr[ scheme ][ magn ])) {
+	if (buffer->index >= fore200e_rx_buf_nbr[ scheme ][ magn ]) {
 	    printk(FORE200E "bsq_audit(%d): queue %d.%d, out of range buffer index = %ld !\n",
 		   where, scheme, magn, buffer->index);
 	}
-- 
1.7.4.1


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

* [PATCH 11/14] HID: hiddev: Remove redundant check on unsigned variable
  2012-11-16  6:50 [PATCH 00/14] Modify signed comparisons of unsigned variables Tushar Behera
                   ` (10 preceding siblings ...)
  2012-11-16  6:50 ` [PATCH 10/14] atm: Removed " Tushar Behera
@ 2012-11-16  6:50 ` Tushar Behera
  2012-11-16  9:27   ` Jiri Kosina
  2012-11-16  6:50 ` [PATCH 12/14] gru: " Tushar Behera
                   ` (2 subsequent siblings)
  14 siblings, 1 reply; 44+ messages in thread
From: Tushar Behera @ 2012-11-16  6:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: patches, Jiri Kosina, linux-usb, linux-input

No need to check whether unsigned variable is less than 0.

CC: Jiri Kosina <jkosina@suse.cz>
CC: linux-usb@vger.kernel.org
CC: linux-input@vger.kernel.org
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 drivers/hid/usbhid/hiddev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index 14599e2..711c965 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -625,7 +625,7 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 		break;
 
 	case HIDIOCAPPLICATION:
-		if (arg < 0 || arg >= hid->maxapplication)
+		if (arg >= hid->maxapplication)
 			break;
 
 		for (i = 0; i < hid->maxcollection; i++)
-- 
1.7.4.1


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

* [PATCH 12/14] gru: Remove redundant check on unsigned variable
  2012-11-16  6:50 [PATCH 00/14] Modify signed comparisons of unsigned variables Tushar Behera
                   ` (11 preceding siblings ...)
  2012-11-16  6:50 ` [PATCH 11/14] HID: hiddev: Remove " Tushar Behera
@ 2012-11-16  6:50 ` Tushar Behera
  2012-11-16  6:50 ` [PATCH 13/14] misc: tsl2550: " Tushar Behera
  2012-11-16  6:50 ` [PATCH 14/14] wlcore: " Tushar Behera
  14 siblings, 0 replies; 44+ messages in thread
From: Tushar Behera @ 2012-11-16  6:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: patches, Jack Steiner

No need to check whether unsigned variable is less than 0.

CC: Jack Steiner <steiner@sgi.com>
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 drivers/misc/sgi-gru/grukdump.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/misc/sgi-gru/grukdump.c b/drivers/misc/sgi-gru/grukdump.c
index 9b2062d..860733b 100644
--- a/drivers/misc/sgi-gru/grukdump.c
+++ b/drivers/misc/sgi-gru/grukdump.c
@@ -197,7 +197,7 @@ int gru_dump_chiplet_request(unsigned long arg)
 		return -EFAULT;
 
 	/* Currently, only dump by gid is implemented */
-	if (req.gid >= gru_max_gids || req.gid < 0)
+	if (req.gid >= gru_max_gids)
 		return -EINVAL;
 
 	gru = GID_TO_GRU(req.gid);
-- 
1.7.4.1


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

* [PATCH 13/14] misc: tsl2550: Remove redundant check on unsigned variable
  2012-11-16  6:50 [PATCH 00/14] Modify signed comparisons of unsigned variables Tushar Behera
                   ` (12 preceding siblings ...)
  2012-11-16  6:50 ` [PATCH 12/14] gru: " Tushar Behera
@ 2012-11-16  6:50 ` Tushar Behera
  2012-11-16  8:09   ` Arnd Bergmann
  2012-11-16  6:50 ` [PATCH 14/14] wlcore: " Tushar Behera
  14 siblings, 1 reply; 44+ messages in thread
From: Tushar Behera @ 2012-11-16  6:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: patches, Arnd Bergmann

No need to check whether unsigned variable is less than 0.

CC: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 drivers/misc/tsl2550.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/tsl2550.c b/drivers/misc/tsl2550.c
index 0beb298..0438569 100644
--- a/drivers/misc/tsl2550.c
+++ b/drivers/misc/tsl2550.c
@@ -204,7 +204,7 @@ static ssize_t tsl2550_store_power_state(struct device *dev,
 	unsigned long val = simple_strtoul(buf, NULL, 10);
 	int ret;
 
-	if (val < 0 || val > 1)
+	if (val > 1)
 		return -EINVAL;
 
 	mutex_lock(&data->update_lock);
@@ -236,7 +236,7 @@ static ssize_t tsl2550_store_operating_mode(struct device *dev,
 	unsigned long val = simple_strtoul(buf, NULL, 10);
 	int ret;
 
-	if (val < 0 || val > 1)
+	if (val > 1)
 		return -EINVAL;
 
 	if (data->power_state == 0)
-- 
1.7.4.1


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

* [PATCH 14/14] wlcore: Remove redundant check on unsigned variable
  2012-11-16  6:50 [PATCH 00/14] Modify signed comparisons of unsigned variables Tushar Behera
                   ` (13 preceding siblings ...)
  2012-11-16  6:50 ` [PATCH 13/14] misc: tsl2550: " Tushar Behera
@ 2012-11-16  6:50 ` Tushar Behera
  2012-11-16 18:24   ` Luciano Coelho
  14 siblings, 1 reply; 44+ messages in thread
From: Tushar Behera @ 2012-11-16  6:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: patches, Luciano Coelho, linux-wireless, netdev

No need to check whether unsigned variable is less than 0.

CC: Luciano Coelho <coelho@ti.com>
CC: linux-wireless@vger.kernel.org
CC: netdev@vger.kernel.org
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 drivers/net/wireless/ti/wlcore/debugfs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/debugfs.c b/drivers/net/wireless/ti/wlcore/debugfs.c
index c86bb00..93f801d 100644
--- a/drivers/net/wireless/ti/wlcore/debugfs.c
+++ b/drivers/net/wireless/ti/wlcore/debugfs.c
@@ -993,7 +993,7 @@ static ssize_t sleep_auth_write(struct file *file,
 		return -EINVAL;
 	}
 
-	if (value < 0 || value > WL1271_PSM_MAX) {
+	if (value > WL1271_PSM_MAX) {
 		wl1271_warning("sleep_auth must be between 0 and %d",
 			       WL1271_PSM_MAX);
 		return -ERANGE;
-- 
1.7.4.1


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

* Re: [PATCH 07/14] pinctrl: SPEAr: Update error check for unsigned variables
  2012-11-16  6:50 ` [PATCH 07/14] pinctrl: SPEAr: " Tushar Behera
@ 2012-11-16  7:05   ` viresh kumar
  2012-11-23  7:34   ` Linus Walleij
  1 sibling, 0 replies; 44+ messages in thread
From: viresh kumar @ 2012-11-16  7:05 UTC (permalink / raw)
  To: Tushar Behera; +Cc: linux-kernel, patches, Linus Walleij

On Fri, Nov 16, 2012 at 12:20 PM, Tushar Behera
<tushar.behera@linaro.org> wrote:
> Checking '< 0' for unsigned variables always returns false. For error
> codes, use IS_ERR_VALUE() instead.
>
> CC: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
> ---
>  drivers/pinctrl/spear/pinctrl-plgpio.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/pinctrl/spear/pinctrl-plgpio.c b/drivers/pinctrl/spear/pinctrl-plgpio.c
> index 1044ad3..9e0c731 100644
> --- a/drivers/pinctrl/spear/pinctrl-plgpio.c
> +++ b/drivers/pinctrl/spear/pinctrl-plgpio.c
> @@ -283,7 +283,7 @@ static int plgpio_to_irq(struct gpio_chip *chip, unsigned offset)
>  {
>         struct plgpio *plgpio = container_of(chip, struct plgpio, chip);
>
> -       if (plgpio->irq_base < 0)
> +       if (IS_ERR_VALUE(plgpio->irq_base))
>                 return -EINVAL;
>
>         return irq_find_mapping(plgpio->irq_domain, offset);

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

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

* Re: [PATCH 13/14] misc: tsl2550: Remove redundant check on unsigned variable
  2012-11-16  6:50 ` [PATCH 13/14] misc: tsl2550: " Tushar Behera
@ 2012-11-16  8:09   ` Arnd Bergmann
  0 siblings, 0 replies; 44+ messages in thread
From: Arnd Bergmann @ 2012-11-16  8:09 UTC (permalink / raw)
  To: Tushar Behera; +Cc: linux-kernel, patches

On Friday 16 November 2012, Tushar Behera wrote:
> No need to check whether unsigned variable is less than 0.
> 
> CC: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>

Acked-by: Arnd Bergmann <arnd@arndb.de>

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

* Re: [PATCH 08/14] xen: netback: Remove redundant check on unsigned variable
  2012-11-16  6:50 ` [PATCH 08/14] xen: netback: Remove redundant check on unsigned variable Tushar Behera
@ 2012-11-16  9:16   ` Ian Campbell
  2012-12-28  5:15     ` Tushar Behera
  0 siblings, 1 reply; 44+ messages in thread
From: Ian Campbell @ 2012-11-16  9:16 UTC (permalink / raw)
  To: Tushar Behera; +Cc: linux-kernel, patches, xen-devel, netdev

On Fri, 2012-11-16 at 06:50 +0000, Tushar Behera wrote:
> No need to check whether unsigned variable is less than 0.
> 
> CC: Ian Campbell <ian.campbell@citrix.com>
> CC: xen-devel@lists.xensource.com
> CC: netdev@vger.kernel.org
> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>

Acked-by: Ian Campbell <ian.campbell@citrix.com>

Thanks.

> ---
>  drivers/net/xen-netback/netback.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
> index aab8677..515e10c 100644
> --- a/drivers/net/xen-netback/netback.c
> +++ b/drivers/net/xen-netback/netback.c
> @@ -190,14 +190,14 @@ static int get_page_ext(struct page *pg,
>  
>  	group = ext.e.group - 1;
>  
> -	if (group < 0 || group >= xen_netbk_group_nr)
> +	if (group >= xen_netbk_group_nr)
>  		return 0;
>  
>  	netbk = &xen_netbk[group];
>  
>  	idx = ext.e.idx;
>  
> -	if ((idx < 0) || (idx >= MAX_PENDING_REQS))
> +	if (idx >= MAX_PENDING_REQS)
>  		return 0;
>  
>  	if (netbk->mmap_pages[idx] != pg)



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

* Re: [PATCH 11/14] HID: hiddev: Remove redundant check on unsigned variable
  2012-11-16  6:50 ` [PATCH 11/14] HID: hiddev: Remove " Tushar Behera
@ 2012-11-16  9:27   ` Jiri Kosina
  0 siblings, 0 replies; 44+ messages in thread
From: Jiri Kosina @ 2012-11-16  9:27 UTC (permalink / raw)
  To: Tushar Behera; +Cc: linux-kernel, patches, linux-usb, linux-input

On Fri, 16 Nov 2012, Tushar Behera wrote:

> No need to check whether unsigned variable is less than 0.
> 
> CC: Jiri Kosina <jkosina@suse.cz>
> CC: linux-usb@vger.kernel.org
> CC: linux-input@vger.kernel.org
> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
> ---
>  drivers/hid/usbhid/hiddev.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
> index 14599e2..711c965 100644
> --- a/drivers/hid/usbhid/hiddev.c
> +++ b/drivers/hid/usbhid/hiddev.c
> @@ -625,7 +625,7 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
>  		break;
>  
>  	case HIDIOCAPPLICATION:
> -		if (arg < 0 || arg >= hid->maxapplication)
> +		if (arg >= hid->maxapplication)
>  			break;
>  
>  		for (i = 0; i < hid->maxcollection; i++)

Applied, thanks.

-- 
Jiri Kosina
SUSE Labs

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

* Re: [PATCH 09/14] xen: events: Remove redundant check on unsigned variable
  2012-11-16  6:50 ` [PATCH 09/14] xen: events: " Tushar Behera
@ 2012-11-16 16:09     ` Konrad Rzeszutek Wilk
  0 siblings, 0 replies; 44+ messages in thread
From: Konrad Rzeszutek Wilk @ 2012-11-16 16:09 UTC (permalink / raw)
  To: Tushar Behera
  Cc: linux-kernel, patches, Jeremy Fitzhardinge, xen-devel, virtualization

On Fri, Nov 16, 2012 at 12:20:41PM +0530, Tushar Behera wrote:
> No need to check whether unsigned variable is less than 0.
> 
> CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

> CC: Jeremy Fitzhardinge <jeremy@goop.org>
> CC: xen-devel@lists.xensource.com
> CC: virtualization@lists.linux-foundation.org
> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
> ---
>  drivers/xen/events.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/xen/events.c b/drivers/xen/events.c
> index 4293c57..cadd7d1 100644
> --- a/drivers/xen/events.c
> +++ b/drivers/xen/events.c
> @@ -216,7 +216,7 @@ static void xen_irq_info_pirq_init(unsigned irq,
>   */
>  static unsigned int evtchn_from_irq(unsigned irq)
>  {
> -	if (unlikely(WARN(irq < 0 || irq >= nr_irqs, "Invalid irq %d!\n", irq)))
> +	if (unlikely(WARN(irq >= nr_irqs, "Invalid irq %d!\n", irq)))
>  		return 0;
>  
>  	return info_for_irq(irq)->evtchn;
> -- 
> 1.7.4.1

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

* Re: [PATCH 09/14] xen: events: Remove redundant check on unsigned variable
@ 2012-11-16 16:09     ` Konrad Rzeszutek Wilk
  0 siblings, 0 replies; 44+ messages in thread
From: Konrad Rzeszutek Wilk @ 2012-11-16 16:09 UTC (permalink / raw)
  To: Tushar Behera
  Cc: Jeremy Fitzhardinge, xen-devel, virtualization, linux-kernel, patches

On Fri, Nov 16, 2012 at 12:20:41PM +0530, Tushar Behera wrote:
> No need to check whether unsigned variable is less than 0.
> 
> CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

> CC: Jeremy Fitzhardinge <jeremy@goop.org>
> CC: xen-devel@lists.xensource.com
> CC: virtualization@lists.linux-foundation.org
> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
> ---
>  drivers/xen/events.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/xen/events.c b/drivers/xen/events.c
> index 4293c57..cadd7d1 100644
> --- a/drivers/xen/events.c
> +++ b/drivers/xen/events.c
> @@ -216,7 +216,7 @@ static void xen_irq_info_pirq_init(unsigned irq,
>   */
>  static unsigned int evtchn_from_irq(unsigned irq)
>  {
> -	if (unlikely(WARN(irq < 0 || irq >= nr_irqs, "Invalid irq %d!\n", irq)))
> +	if (unlikely(WARN(irq >= nr_irqs, "Invalid irq %d!\n", irq)))
>  		return 0;
>  
>  	return info_for_irq(irq)->evtchn;
> -- 
> 1.7.4.1

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

* Re: [PATCH 09/14] xen: events: Remove redundant check on unsigned variable
  2012-11-16 16:09     ` Konrad Rzeszutek Wilk
  (?)
@ 2012-11-16 16:53     ` Jeremy Fitzhardinge
  -1 siblings, 0 replies; 44+ messages in thread
From: Jeremy Fitzhardinge @ 2012-11-16 16:53 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Tushar Behera
  Cc: xen-devel, virtualization, linux-kernel, patches


[-- Attachment #1.1: Type: text/plain, Size: 1501 bytes --]

To be honest I'd nack this kind of patch. The test is only redundant in the most trivial sense that the compiler can easily optimise away. The point of the test is to make sure that the range is OK even if the type subsequently becomes signed (to hold a -ve error, for example).

J

Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote:

>On Fri, Nov 16, 2012 at 12:20:41PM +0530, Tushar Behera wrote:
>> No need to check whether unsigned variable is less than 0.
>> 
>> CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>
>Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>
>> CC: Jeremy Fitzhardinge <jeremy@goop.org>
>> CC: xen-devel@lists.xensource.com
>> CC: virtualization@lists.linux-foundation.org
>> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
>> ---
>>  drivers/xen/events.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>> 
>> diff --git a/drivers/xen/events.c b/drivers/xen/events.c
>> index 4293c57..cadd7d1 100644
>> --- a/drivers/xen/events.c
>> +++ b/drivers/xen/events.c
>> @@ -216,7 +216,7 @@ static void xen_irq_info_pirq_init(unsigned irq,
>>   */
>>  static unsigned int evtchn_from_irq(unsigned irq)
>>  {
>> -	if (unlikely(WARN(irq < 0 || irq >= nr_irqs, "Invalid irq %d!\n",
>irq)))
>> +	if (unlikely(WARN(irq >= nr_irqs, "Invalid irq %d!\n", irq)))
>>  		return 0;
>>  
>>  	return info_for_irq(irq)->evtchn;
>> -- 
>> 1.7.4.1

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

[-- Attachment #1.2: Type: text/html, Size: 2231 bytes --]

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

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

* Re: [PATCH 09/14] xen: events: Remove redundant check on unsigned variable
  2012-11-16 16:09     ` Konrad Rzeszutek Wilk
  (?)
  (?)
@ 2012-11-16 16:53     ` Jeremy Fitzhardinge
  2012-11-19  3:52         ` Tushar Behera
  -1 siblings, 1 reply; 44+ messages in thread
From: Jeremy Fitzhardinge @ 2012-11-16 16:53 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Tushar Behera
  Cc: xen-devel, virtualization, linux-kernel, patches


[-- Attachment #1.1: Type: text/plain, Size: 1462 bytes --]

To be honest I'd nack this kind of patch. The test is only redundant in the most trivial sense that the compiler can easily optimise away. The point of the test is to make sure that the range is OK even if the type subsequently becomes signed (to hold a -ve error, for example).

J

Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote:

>On Fri, Nov 16, 2012 at 12:20:41PM +0530, Tushar Behera wrote:
>> No need to check whether unsigned variable is less than 0.
>> 
>> CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>
>Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>
>> CC: Jeremy Fitzhardinge <jeremy@goop.org>
>> CC: xen-devel@lists.xensource.com
>> CC: virtualization@lists.linux-foundation.org
>> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
>> ---
>>  drivers/xen/events.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>> 
>> diff --git a/drivers/xen/events.c b/drivers/xen/events.c
>> index 4293c57..cadd7d1 100644
>> --- a/drivers/xen/events.c
>> +++ b/drivers/xen/events.c
>> @@ -216,7 +216,7 @@ static void xen_irq_info_pirq_init(unsigned irq,
>>   */
>>  static unsigned int evtchn_from_irq(unsigned irq)
>>  {
>> -	if (unlikely(WARN(irq < 0 || irq >= nr_irqs, "Invalid irq %d!\n",
>irq)))
>> +	if (unlikely(WARN(irq >= nr_irqs, "Invalid irq %d!\n", irq)))
>>  		return 0;
>>  
>>  	return info_for_irq(irq)->evtchn;
>> -- 
>> 1.7.4.1

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

[-- Attachment #1.2: Type: text/html, Size: 2224 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: [PATCH 14/14] wlcore: Remove redundant check on unsigned variable
  2012-11-16  6:50 ` [PATCH 14/14] wlcore: " Tushar Behera
@ 2012-11-16 18:24   ` Luciano Coelho
  0 siblings, 0 replies; 44+ messages in thread
From: Luciano Coelho @ 2012-11-16 18:24 UTC (permalink / raw)
  To: Tushar Behera; +Cc: linux-kernel, patches, linux-wireless, netdev

On Fri, 2012-11-16 at 12:20 +0530, Tushar Behera wrote:
> No need to check whether unsigned variable is less than 0.
> 
> CC: Luciano Coelho <coelho@ti.com>
> CC: linux-wireless@vger.kernel.org
> CC: netdev@vger.kernel.org
> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
> ---

Applied in the wl12xx.git tree.  Thanks!

--
Luca.


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

* Re: [PATCH 06/14] pinctrl: samsung: Update error check for unsigned variables
  2012-11-16  6:50 ` [PATCH 06/14] pinctrl: samsung: " Tushar Behera
@ 2012-11-17 20:31   ` Linus Walleij
  2012-11-19  1:29     ` Kukjin Kim
  0 siblings, 1 reply; 44+ messages in thread
From: Linus Walleij @ 2012-11-17 20:31 UTC (permalink / raw)
  To: Tushar Behera, Kukjin Kim; +Cc: linux-kernel, patches

On Fri, Nov 16, 2012 at 7:50 AM, Tushar Behera <tushar.behera@linaro.org> wrote:

> Checking '< 0' for unsigned variables always returns false. For error
> codes, use IS_ERR_VALUE() instead.
>
> CC: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
> ---
>  drivers/pinctrl/pinctrl-samsung.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/pinctrl/pinctrl-samsung.c b/drivers/pinctrl/pinctrl-samsung.c
> index 81c9896..3b52c17 100644
> --- a/drivers/pinctrl/pinctrl-samsung.c
> +++ b/drivers/pinctrl/pinctrl-samsung.c
> @@ -560,7 +560,7 @@ static int __devinit samsung_pinctrl_parse_dt_pins(struct platform_device *pdev,
>         const char *pin_name;
>
>         *npins = of_property_count_strings(cfg_np, "samsung,pins");
> -       if (*npins < 0) {
> +       if (IS_ERR_VALUE(*npins)) {
>                 dev_err(dev, "invalid pin list in %s node", cfg_np->name);
>                 return -EINVAL;
>         }

Acked-by: Linus Walleij <linus.walleij@linaro.org>

For this merge window Kukjin is handling the Samsung pinctrl patches,
Kukjin can you pick this to your tree to avoid any mess?

Yours,
Linus Walleij

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

* Re: [PATCH 05/14] [media] atmel-isi: Update error check for unsigned variables
  2012-11-16  6:50 ` [PATCH 05/14] [media] atmel-isi: Update error check for unsigned variables Tushar Behera
@ 2012-11-17 23:16   ` Guennadi Liakhovetski
  2012-11-19  3:55     ` Tushar Behera
  0 siblings, 1 reply; 44+ messages in thread
From: Guennadi Liakhovetski @ 2012-11-17 23:16 UTC (permalink / raw)
  To: Tushar Behera; +Cc: linux-kernel, patches, Mauro Carvalho Chehab, linux-media

On Fri, 16 Nov 2012, Tushar Behera wrote:

> Checking '< 0' for unsigned variables always returns false. For error
> codes, use IS_ERR_VALUE() instead.

Wouldn't just changing "irq" type to "int" also work? I think that would 
be a more straight-forward solution. If however there are strong arguments 
against that, I'm fine with this fix too.

Thanks
Guennadi

> 
> CC: Mauro Carvalho Chehab <mchehab@infradead.org>
> CC: linux-media@vger.kernel.org
> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
> ---
>  drivers/media/platform/soc_camera/atmel-isi.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c
> index 6274a91..5bd65df 100644
> --- a/drivers/media/platform/soc_camera/atmel-isi.c
> +++ b/drivers/media/platform/soc_camera/atmel-isi.c
> @@ -1020,7 +1020,7 @@ static int __devinit atmel_isi_probe(struct platform_device *pdev)
>  	isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS);
>  
>  	irq = platform_get_irq(pdev, 0);
> -	if (irq < 0) {
> +	if (IS_ERR_VALUE(irq)) {
>  		ret = irq;
>  		goto err_req_irq;
>  	}
> -- 
> 1.7.4.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

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

* RE: [PATCH 06/14] pinctrl: samsung: Update error check for unsigned variables
  2012-11-17 20:31   ` Linus Walleij
@ 2012-11-19  1:29     ` Kukjin Kim
  0 siblings, 0 replies; 44+ messages in thread
From: Kukjin Kim @ 2012-11-19  1:29 UTC (permalink / raw)
  To: 'Linus Walleij', 'Tushar Behera'; +Cc: linux-kernel, patches

Linus Walleij wrote:
> 
> On Fri, Nov 16, 2012 at 7:50 AM, Tushar Behera <tushar.behera@linaro.org>
> wrote:
> 
> > Checking '< 0' for unsigned variables always returns false. For error
> > codes, use IS_ERR_VALUE() instead.
> >
> > CC: Linus Walleij <linus.walleij@linaro.org>
> > Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
> > ---
> >  drivers/pinctrl/pinctrl-samsung.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/pinctrl/pinctrl-samsung.c
> b/drivers/pinctrl/pinctrl-samsung.c
> > index 81c9896..3b52c17 100644
> > --- a/drivers/pinctrl/pinctrl-samsung.c
> > +++ b/drivers/pinctrl/pinctrl-samsung.c
> > @@ -560,7 +560,7 @@ static int __devinit
> samsung_pinctrl_parse_dt_pins(struct platform_device *pdev,
> >         const char *pin_name;
> >
> >         *npins = of_property_count_strings(cfg_np, "samsung,pins");
> > -       if (*npins < 0) {
> > +       if (IS_ERR_VALUE(*npins)) {
> >                 dev_err(dev, "invalid pin list in %s node",
cfg_np->name);
> >                 return -EINVAL;
> >         }
> 
> Acked-by: Linus Walleij <linus.walleij@linaro.org>
> 
> For this merge window Kukjin is handling the Samsung pinctrl patches,
> Kukjin can you pick this to your tree to avoid any mess?
> 
Sure, I will.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.


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

* Re: [PATCH 09/14] xen: events: Remove redundant check on unsigned variable
  2012-11-16 16:53     ` Jeremy Fitzhardinge
@ 2012-11-19  3:52         ` Tushar Behera
  0 siblings, 0 replies; 44+ messages in thread
From: Tushar Behera @ 2012-11-19  3:52 UTC (permalink / raw)
  To: Jeremy Fitzhardinge
  Cc: Konrad Rzeszutek Wilk, linux-kernel, patches, xen-devel, virtualization

On 11/16/2012 10:23 PM, Jeremy Fitzhardinge wrote:
> To be honest I'd nack this kind of patch. The test is only redundant in the most trivial sense that the compiler can easily optimise away. The point of the test is to make sure that the range is OK even if the type subsequently becomes signed (to hold a -ve error, for example).
> 
> J
> 

The check is on the function argument which is unsigned, so checking '<
0' doesn't make sense. We should force signed check only if the argument
is of signed type. In any case, even if irq has been assigned some error
value, that would be caught by the check irq >= nr_irqs.

> Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote:
> 
>> On Fri, Nov 16, 2012 at 12:20:41PM +0530, Tushar Behera wrote:
>>> No need to check whether unsigned variable is less than 0.
>>>
>>> CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>>
>> Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>>
>>> CC: Jeremy Fitzhardinge <jeremy@goop.org>
>>> CC: xen-devel@lists.xensource.com
>>> CC: virtualization@lists.linux-foundation.org
>>> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
>>> ---
>>>  drivers/xen/events.c |    2 +-
>>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/drivers/xen/events.c b/drivers/xen/events.c
>>> index 4293c57..cadd7d1 100644
>>> --- a/drivers/xen/events.c
>>> +++ b/drivers/xen/events.c
>>> @@ -216,7 +216,7 @@ static void xen_irq_info_pirq_init(unsigned irq,
>>>   */
>>>  static unsigned int evtchn_from_irq(unsigned irq)
>>>  {
>>> -	if (unlikely(WARN(irq < 0 || irq >= nr_irqs, "Invalid irq %d!\n",
>> irq)))
>>> +	if (unlikely(WARN(irq >= nr_irqs, "Invalid irq %d!\n", irq)))
>>>  		return 0;
>>>  
>>>  	return info_for_irq(irq)->evtchn;
>>> -- 
>>> 1.7.4.1
> 


-- 
Tushar Behera

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

* Re: [PATCH 09/14] xen: events: Remove redundant check on unsigned variable
@ 2012-11-19  3:52         ` Tushar Behera
  0 siblings, 0 replies; 44+ messages in thread
From: Tushar Behera @ 2012-11-19  3:52 UTC (permalink / raw)
  To: Jeremy Fitzhardinge
  Cc: xen-devel, patches, virtualization, linux-kernel, Konrad Rzeszutek Wilk

On 11/16/2012 10:23 PM, Jeremy Fitzhardinge wrote:
> To be honest I'd nack this kind of patch. The test is only redundant in the most trivial sense that the compiler can easily optimise away. The point of the test is to make sure that the range is OK even if the type subsequently becomes signed (to hold a -ve error, for example).
> 
> J
> 

The check is on the function argument which is unsigned, so checking '<
0' doesn't make sense. We should force signed check only if the argument
is of signed type. In any case, even if irq has been assigned some error
value, that would be caught by the check irq >= nr_irqs.

> Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote:
> 
>> On Fri, Nov 16, 2012 at 12:20:41PM +0530, Tushar Behera wrote:
>>> No need to check whether unsigned variable is less than 0.
>>>
>>> CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>>
>> Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>>
>>> CC: Jeremy Fitzhardinge <jeremy@goop.org>
>>> CC: xen-devel@lists.xensource.com
>>> CC: virtualization@lists.linux-foundation.org
>>> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
>>> ---
>>>  drivers/xen/events.c |    2 +-
>>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/drivers/xen/events.c b/drivers/xen/events.c
>>> index 4293c57..cadd7d1 100644
>>> --- a/drivers/xen/events.c
>>> +++ b/drivers/xen/events.c
>>> @@ -216,7 +216,7 @@ static void xen_irq_info_pirq_init(unsigned irq,
>>>   */
>>>  static unsigned int evtchn_from_irq(unsigned irq)
>>>  {
>>> -	if (unlikely(WARN(irq < 0 || irq >= nr_irqs, "Invalid irq %d!\n",
>> irq)))
>>> +	if (unlikely(WARN(irq >= nr_irqs, "Invalid irq %d!\n", irq)))
>>>  		return 0;
>>>  
>>>  	return info_for_irq(irq)->evtchn;
>>> -- 
>>> 1.7.4.1
> 


-- 
Tushar Behera

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

* Re: [PATCH 05/14] [media] atmel-isi: Update error check for unsigned variables
  2012-11-17 23:16   ` Guennadi Liakhovetski
@ 2012-11-19  3:55     ` Tushar Behera
  0 siblings, 0 replies; 44+ messages in thread
From: Tushar Behera @ 2012-11-19  3:55 UTC (permalink / raw)
  To: Guennadi Liakhovetski
  Cc: linux-kernel, patches, Mauro Carvalho Chehab, linux-media

On 11/18/2012 04:46 AM, Guennadi Liakhovetski wrote:
> On Fri, 16 Nov 2012, Tushar Behera wrote:
> 
>> Checking '< 0' for unsigned variables always returns false. For error
>> codes, use IS_ERR_VALUE() instead.
> 
> Wouldn't just changing "irq" type to "int" also work? I think that would 
> be a more straight-forward solution. If however there are strong arguments 
> against that, I'm fine with this fix too.
> 

By changing irq to signed variable, we would get compilation warning in
subsequent line (request_irq).

> Thanks
> Guennadi
> 
>>
>> CC: Mauro Carvalho Chehab <mchehab@infradead.org>
>> CC: linux-media@vger.kernel.org
>> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
>> ---
>>  drivers/media/platform/soc_camera/atmel-isi.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c
>> index 6274a91..5bd65df 100644
>> --- a/drivers/media/platform/soc_camera/atmel-isi.c
>> +++ b/drivers/media/platform/soc_camera/atmel-isi.c
>> @@ -1020,7 +1020,7 @@ static int __devinit atmel_isi_probe(struct platform_device *pdev)
>>  	isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS);
>>  
>>  	irq = platform_get_irq(pdev, 0);
>> -	if (irq < 0) {
>> +	if (IS_ERR_VALUE(irq)) {
>>  		ret = irq;
>>  		goto err_req_irq;
>>  	}
>> -- 
>> 1.7.4.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-media" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
> 
> ---
> Guennadi Liakhovetski, Ph.D.
> Freelance Open-Source Software Developer
> http://www.open-technology.de/
> 


-- 
Tushar Behera

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

* Re: [Xen-devel] [PATCH 09/14] xen: events: Remove redundant check on unsigned variable
  2012-11-19  3:52         ` Tushar Behera
@ 2012-11-19 10:31           ` Ian Campbell
  -1 siblings, 0 replies; 44+ messages in thread
From: Ian Campbell @ 2012-11-19 10:31 UTC (permalink / raw)
  To: Tushar Behera
  Cc: Jeremy Fitzhardinge, xen-devel, patches, virtualization,
	linux-kernel, Konrad Rzeszutek Wilk

On Mon, 2012-11-19 at 03:52 +0000, Tushar Behera wrote:
> On 11/16/2012 10:23 PM, Jeremy Fitzhardinge wrote:
> > To be honest I'd nack this kind of patch. The test is only redundant in the most trivial sense that the compiler can easily optimise away. The point of the test is to make sure that the range is OK even if the type subsequently becomes signed (to hold a -ve error, for example).
> > 
> > J
> > 
> 
> The check is on the function argument which is unsigned, so checking '<
> 0' doesn't make sense. We should force signed check only if the argument
> is of signed type. In any case, even if irq has been assigned some error
> value, that would be caught by the check irq >= nr_irqs.

Jeremy is (I think) arguing that this check is not redundant because
someone might change the type of the argument to be signed and until
then the compiler can trivially optimise the check away, so what's the
harm in it?

I'm somewhat inclined to agree with him.

Ian.


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

* Re: [Xen-devel] [PATCH 09/14] xen: events: Remove redundant check on unsigned variable
  2012-11-19  3:52         ` Tushar Behera
  (?)
  (?)
@ 2012-11-19 10:31         ` Ian Campbell
  -1 siblings, 0 replies; 44+ messages in thread
From: Ian Campbell @ 2012-11-19 10:31 UTC (permalink / raw)
  To: Tushar Behera
  Cc: Jeremy Fitzhardinge, xen-devel, Konrad Rzeszutek Wilk, patches,
	linux-kernel, virtualization

On Mon, 2012-11-19 at 03:52 +0000, Tushar Behera wrote:
> On 11/16/2012 10:23 PM, Jeremy Fitzhardinge wrote:
> > To be honest I'd nack this kind of patch. The test is only redundant in the most trivial sense that the compiler can easily optimise away. The point of the test is to make sure that the range is OK even if the type subsequently becomes signed (to hold a -ve error, for example).
> > 
> > J
> > 
> 
> The check is on the function argument which is unsigned, so checking '<
> 0' doesn't make sense. We should force signed check only if the argument
> is of signed type. In any case, even if irq has been assigned some error
> value, that would be caught by the check irq >= nr_irqs.

Jeremy is (I think) arguing that this check is not redundant because
someone might change the type of the argument to be signed and until
then the compiler can trivially optimise the check away, so what's the
harm in it?

I'm somewhat inclined to agree with him.

Ian.

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

* Re: [PATCH 09/14] xen: events: Remove redundant check on unsigned variable
@ 2012-11-19 10:31           ` Ian Campbell
  0 siblings, 0 replies; 44+ messages in thread
From: Ian Campbell @ 2012-11-19 10:31 UTC (permalink / raw)
  To: Tushar Behera
  Cc: Jeremy Fitzhardinge, xen-devel, Konrad Rzeszutek Wilk, patches,
	linux-kernel, virtualization

On Mon, 2012-11-19 at 03:52 +0000, Tushar Behera wrote:
> On 11/16/2012 10:23 PM, Jeremy Fitzhardinge wrote:
> > To be honest I'd nack this kind of patch. The test is only redundant in the most trivial sense that the compiler can easily optimise away. The point of the test is to make sure that the range is OK even if the type subsequently becomes signed (to hold a -ve error, for example).
> > 
> > J
> > 
> 
> The check is on the function argument which is unsigned, so checking '<
> 0' doesn't make sense. We should force signed check only if the argument
> is of signed type. In any case, even if irq has been assigned some error
> value, that would be caught by the check irq >= nr_irqs.

Jeremy is (I think) arguing that this check is not redundant because
someone might change the type of the argument to be signed and until
then the compiler can trivially optimise the check away, so what's the
harm in it?

I'm somewhat inclined to agree with him.

Ian.

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

* Re: [Xen-devel] [PATCH 09/14] xen: events: Remove redundant check on unsigned variable
  2012-11-19 10:31           ` Ian Campbell
@ 2012-11-19 11:00             ` Tushar Behera
  -1 siblings, 0 replies; 44+ messages in thread
From: Tushar Behera @ 2012-11-19 11:00 UTC (permalink / raw)
  To: Ian Campbell
  Cc: Jeremy Fitzhardinge, xen-devel, patches, virtualization,
	linux-kernel, Konrad Rzeszutek Wilk

On 11/19/2012 04:01 PM, Ian Campbell wrote:
> On Mon, 2012-11-19 at 03:52 +0000, Tushar Behera wrote:
>> On 11/16/2012 10:23 PM, Jeremy Fitzhardinge wrote:
>>> To be honest I'd nack this kind of patch. The test is only redundant in the most trivial sense that the compiler can easily optimise away. The point of the test is to make sure that the range is OK even if the type subsequently becomes signed (to hold a -ve error, for example).
>>>
>>> J
>>>
>>
>> The check is on the function argument which is unsigned, so checking '<
>> 0' doesn't make sense. We should force signed check only if the argument
>> is of signed type. In any case, even if irq has been assigned some error
>> value, that would be caught by the check irq >= nr_irqs.
> 
> Jeremy is (I think) arguing that this check is not redundant because
> someone might change the type of the argument to be signed and until
> then the compiler can trivially optimise the check away, so what's the
> harm in it?
> 
> I'm somewhat inclined to agree with him.
> 
> Ian.
> 
Ok, I don't have much argument against this.

-- 
Tushar Behera

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

* Re: [Xen-devel] [PATCH 09/14] xen: events: Remove redundant check on unsigned variable
@ 2012-11-19 11:00             ` Tushar Behera
  0 siblings, 0 replies; 44+ messages in thread
From: Tushar Behera @ 2012-11-19 11:00 UTC (permalink / raw)
  To: Ian Campbell
  Cc: Jeremy Fitzhardinge, xen-devel, Konrad Rzeszutek Wilk, patches,
	linux-kernel, virtualization

On 11/19/2012 04:01 PM, Ian Campbell wrote:
> On Mon, 2012-11-19 at 03:52 +0000, Tushar Behera wrote:
>> On 11/16/2012 10:23 PM, Jeremy Fitzhardinge wrote:
>>> To be honest I'd nack this kind of patch. The test is only redundant in the most trivial sense that the compiler can easily optimise away. The point of the test is to make sure that the range is OK even if the type subsequently becomes signed (to hold a -ve error, for example).
>>>
>>> J
>>>
>>
>> The check is on the function argument which is unsigned, so checking '<
>> 0' doesn't make sense. We should force signed check only if the argument
>> is of signed type. In any case, even if irq has been assigned some error
>> value, that would be caught by the check irq >= nr_irqs.
> 
> Jeremy is (I think) arguing that this check is not redundant because
> someone might change the type of the argument to be signed and until
> then the compiler can trivially optimise the check away, so what's the
> harm in it?
> 
> I'm somewhat inclined to agree with him.
> 
> Ian.
> 
Ok, I don't have much argument against this.

-- 
Tushar Behera

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

* Re: [PATCH 07/14] pinctrl: SPEAr: Update error check for unsigned variables
  2012-11-16  6:50 ` [PATCH 07/14] pinctrl: SPEAr: " Tushar Behera
  2012-11-16  7:05   ` viresh kumar
@ 2012-11-23  7:34   ` Linus Walleij
  1 sibling, 0 replies; 44+ messages in thread
From: Linus Walleij @ 2012-11-23  7:34 UTC (permalink / raw)
  To: Tushar Behera; +Cc: linux-kernel, patches

On Fri, Nov 16, 2012 at 7:50 AM, Tushar Behera <tushar.behera@linaro.org> wrote:

> Checking '< 0' for unsigned variables always returns false. For error
> codes, use IS_ERR_VALUE() instead.
>
> CC: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>

Patch applied with Viresh's ACK, thanks!
Linus Walleij

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

* Re: [PATCH 08/14] xen: netback: Remove redundant check on unsigned variable
  2012-11-16  9:16   ` Ian Campbell
@ 2012-12-28  5:15     ` Tushar Behera
  2012-12-28 10:41         ` Wei Liu
  0 siblings, 1 reply; 44+ messages in thread
From: Tushar Behera @ 2012-12-28  5:15 UTC (permalink / raw)
  To: Ian Campbell; +Cc: linux-kernel, patches, xen-devel, netdev

On 11/16/2012 02:46 PM, Ian Campbell wrote:
> On Fri, 2012-11-16 at 06:50 +0000, Tushar Behera wrote:
>> No need to check whether unsigned variable is less than 0.
>>
>> CC: Ian Campbell <ian.campbell@citrix.com>
>> CC: xen-devel@lists.xensource.com
>> CC: netdev@vger.kernel.org
>> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
> 
> Acked-by: Ian Campbell <ian.campbell@citrix.com>
> 
> Thanks.
> 

This patch was not picked up for 3.8-rc1. Any idea, who should pick this up?

>> ---
>>  drivers/net/xen-netback/netback.c |    4 ++--
>>  1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
>> index aab8677..515e10c 100644
>> --- a/drivers/net/xen-netback/netback.c
>> +++ b/drivers/net/xen-netback/netback.c
>> @@ -190,14 +190,14 @@ static int get_page_ext(struct page *pg,
>>  
>>  	group = ext.e.group - 1;
>>  
>> -	if (group < 0 || group >= xen_netbk_group_nr)
>> +	if (group >= xen_netbk_group_nr)
>>  		return 0;
>>  
>>  	netbk = &xen_netbk[group];
>>  
>>  	idx = ext.e.idx;
>>  
>> -	if ((idx < 0) || (idx >= MAX_PENDING_REQS))
>> +	if (idx >= MAX_PENDING_REQS)
>>  		return 0;
>>  
>>  	if (netbk->mmap_pages[idx] != pg)
> 
> 


-- 
Tushar Behera

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

* Re: [PATCH 10/14] atm: Removed redundant check on unsigned variable
  2012-11-16  6:50 ` [PATCH 10/14] atm: Removed " Tushar Behera
@ 2012-12-28  5:16   ` Tushar Behera
  2012-12-31 15:18     ` chas williams - CONTRACTOR
  0 siblings, 1 reply; 44+ messages in thread
From: Tushar Behera @ 2012-12-28  5:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: patches, Chas Williams, linux-atm-general, netdev

Ping.

On 11/16/2012 12:20 PM, Tushar Behera wrote:
> No need to check whether unsigned variable is less than 0.
> 
> CC: Chas Williams <chas@cmf.nrl.navy.mil>
> CC: linux-atm-general@lists.sourceforge.net
> CC: netdev@vger.kernel.org
> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
> ---
>  drivers/atm/fore200e.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
> index 361f5ae..fdd3fe7 100644
> --- a/drivers/atm/fore200e.c
> +++ b/drivers/atm/fore200e.c
> @@ -972,7 +972,7 @@ int bsq_audit(int where, struct host_bsq* bsq, int scheme, int magn)
>  		   where, scheme, magn, buffer->index, buffer->scheme);
>  	}
>  
> -	if ((buffer->index < 0) || (buffer->index >= fore200e_rx_buf_nbr[ scheme ][ magn ])) {
> +	if (buffer->index >= fore200e_rx_buf_nbr[ scheme ][ magn ]) {
>  	    printk(FORE200E "bsq_audit(%d): queue %d.%d, out of range buffer index = %ld !\n",
>  		   where, scheme, magn, buffer->index);
>  	}
> 


-- 
Tushar Behera

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

* Re: [Xen-devel] [PATCH 08/14] xen: netback: Remove redundant check on unsigned variable
  2012-12-28  5:15     ` Tushar Behera
@ 2012-12-28 10:41         ` Wei Liu
  0 siblings, 0 replies; 44+ messages in thread
From: Wei Liu @ 2012-12-28 10:41 UTC (permalink / raw)
  To: Tushar Behera
  Cc: wei.liu2, Ian Campbell, netdev, xen-devel, linux-kernel, patches,
	konrad.wilk

On Fri, 2012-12-28 at 05:15 +0000, Tushar Behera wrote:
> On 11/16/2012 02:46 PM, Ian Campbell wrote:
> > On Fri, 2012-11-16 at 06:50 +0000, Tushar Behera wrote:
> >> No need to check whether unsigned variable is less than 0.
> >>
> >> CC: Ian Campbell <ian.campbell@citrix.com>
> >> CC: xen-devel@lists.xensource.com
> >> CC: netdev@vger.kernel.org
> >> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
> > 
> > Acked-by: Ian Campbell <ian.campbell@citrix.com>
> > 
> > Thanks.
> > 
> 
> This patch was not picked up for 3.8-rc1. Any idea, who should pick this up?

CC'ing Konrad.


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

* Re: [Xen-devel] [PATCH 08/14] xen: netback: Remove redundant check on unsigned variable
@ 2012-12-28 10:41         ` Wei Liu
  0 siblings, 0 replies; 44+ messages in thread
From: Wei Liu @ 2012-12-28 10:41 UTC (permalink / raw)
  To: Tushar Behera
  Cc: wei.liu2, Ian Campbell, netdev, xen-devel, linux-kernel, patches,
	konrad.wilk

On Fri, 2012-12-28 at 05:15 +0000, Tushar Behera wrote:
> On 11/16/2012 02:46 PM, Ian Campbell wrote:
> > On Fri, 2012-11-16 at 06:50 +0000, Tushar Behera wrote:
> >> No need to check whether unsigned variable is less than 0.
> >>
> >> CC: Ian Campbell <ian.campbell@citrix.com>
> >> CC: xen-devel@lists.xensource.com
> >> CC: netdev@vger.kernel.org
> >> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
> > 
> > Acked-by: Ian Campbell <ian.campbell@citrix.com>
> > 
> > Thanks.
> > 
> 
> This patch was not picked up for 3.8-rc1. Any idea, who should pick this up?

CC'ing Konrad.

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

* Re: [PATCH 10/14] atm: Removed redundant check on unsigned variable
  2012-12-28  5:16   ` Tushar Behera
@ 2012-12-31 15:18     ` chas williams - CONTRACTOR
  0 siblings, 0 replies; 44+ messages in thread
From: chas williams - CONTRACTOR @ 2012-12-31 15:18 UTC (permalink / raw)
  To: Tushar Behera; +Cc: linux-kernel, patches, linux-atm-general, netdev

Acked-by: chas williams - CONTRACTOR <chas@cmf.nrl.navy.mil>

On Fri, 28 Dec 2012 10:46:36 +0530
Tushar Behera <tushar.behera@linaro.org> wrote:

> Ping.
> 
> On 11/16/2012 12:20 PM, Tushar Behera wrote:
> > No need to check whether unsigned variable is less than 0.
> > 
> > CC: Chas Williams <chas@cmf.nrl.navy.mil>
> > CC: linux-atm-general@lists.sourceforge.net
> > CC: netdev@vger.kernel.org
> > Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
> > ---
> >  drivers/atm/fore200e.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
> > index 361f5ae..fdd3fe7 100644
> > --- a/drivers/atm/fore200e.c
> > +++ b/drivers/atm/fore200e.c
> > @@ -972,7 +972,7 @@ int bsq_audit(int where, struct host_bsq* bsq, int scheme, int magn)
> >  		   where, scheme, magn, buffer->index, buffer->scheme);
> >  	}
> >  
> > -	if ((buffer->index < 0) || (buffer->index >= fore200e_rx_buf_nbr[ scheme ][ magn ])) {
> > +	if (buffer->index >= fore200e_rx_buf_nbr[ scheme ][ magn ]) {
> >  	    printk(FORE200E "bsq_audit(%d): queue %d.%d, out of range buffer index = %ld !\n",
> >  		   where, scheme, magn, buffer->index);
> >  	}
> > 
> 
> 


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

* Re: [Xen-devel] [PATCH 08/14] xen: netback: Remove redundant check on unsigned variable
  2012-12-28 10:41         ` Wei Liu
  (?)
@ 2013-01-02 21:40         ` Konrad Rzeszutek Wilk
  -1 siblings, 0 replies; 44+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-01-02 21:40 UTC (permalink / raw)
  To: Wei Liu, davem
  Cc: Tushar Behera, Ian Campbell, netdev, xen-devel, linux-kernel, patches

On Fri, Dec 28, 2012 at 10:41:32AM +0000, Wei Liu wrote:
> On Fri, 2012-12-28 at 05:15 +0000, Tushar Behera wrote:
> > On 11/16/2012 02:46 PM, Ian Campbell wrote:
> > > On Fri, 2012-11-16 at 06:50 +0000, Tushar Behera wrote:
> > >> No need to check whether unsigned variable is less than 0.
> > >>
> > >> CC: Ian Campbell <ian.campbell@citrix.com>
> > >> CC: xen-devel@lists.xensource.com
> > >> CC: netdev@vger.kernel.org
> > >> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
> > > 
> > > Acked-by: Ian Campbell <ian.campbell@citrix.com>
> > > 
> > > Thanks.
> > > 
> > 
> > This patch was not picked up for 3.8-rc1. Any idea, who should pick this up?
> 
> CC'ing Konrad.
> 

And CC-ing the network maintainer. David, Ian (who is the sub-maintainer
of xen-netback) has Acked the patch.

I can put this in my queue if you would like.


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

* [PATCH 00/14] Modify signed comparisons of unsigned variables
@ 2012-11-16  6:50 Tushar Behera
  0 siblings, 0 replies; 44+ messages in thread
From: Tushar Behera @ 2012-11-16  6:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Chas Williams, linux-input, Jeremy Fitzhardinge, Jack Steiner,
	Ian Campbell, Arnd Bergmann, Konrad Rzeszutek Wilk, Jiri Kosina,
	Linus Walleij, patches, linux-wireless, ivtv-devel,
	Mauro Carvalho Chehab, linux-atm-general, Luciano Coelho, netdev,
	linux-usb, virtualization, xen-devel, linux-media

The occurrences were identified through the coccinelle script at
following location.

http://www.emn.fr/z-info/coccinelle/rules/find_unsigned.cocci

Signed checks for unsigned variables are removed if it is also checked
for upper error limit. For error checks, IS_ERR_VALUE() macros is used.

Tushar Behera (14):
  [media] ivtv: Remove redundant check on unsigned variable
  [media] meye: Remove redundant check on unsigned variable
  [media] saa7134: Remove redundant check on unsigned variable
  [media] tlg2300: Remove redundant check on unsigned variable
  [media] atmel-isi: Update error check for unsigned variables
  pinctrl: samsung: Update error check for unsigned variables
  pinctrl: SPEAr: Update error check for unsigned variables
  xen: netback: Remove redundant check on unsigned variable
  xen: events: Remove redundant check on unsigned variable
  atm: Removed redundant check on unsigned variable
  HID: hiddev: Remove redundant check on unsigned variable
  gru: Remove redundant check on unsigned variable
  misc: tsl2550: Remove redundant check on unsigned variable
  wlcore: Remove redundant check on unsigned variable

 drivers/atm/fore200e.c                        |    2 +-
 drivers/hid/usbhid/hiddev.c                   |    2 +-
 drivers/media/pci/ivtv/ivtv-ioctl.c           |    2 +-
 drivers/media/pci/meye/meye.c                 |    2 +-
 drivers/media/pci/saa7134/saa7134-video.c     |    2 +-
 drivers/media/platform/soc_camera/atmel-isi.c |    2 +-
 drivers/media/usb/tlg2300/pd-video.c          |    2 +-
 drivers/misc/sgi-gru/grukdump.c               |    2 +-
 drivers/misc/tsl2550.c                        |    4 ++--
 drivers/net/wireless/ti/wlcore/debugfs.c      |    2 +-
 drivers/net/xen-netback/netback.c             |    4 ++--
 drivers/pinctrl/pinctrl-samsung.c             |    2 +-
 drivers/pinctrl/spear/pinctrl-plgpio.c        |    2 +-
 drivers/xen/events.c                          |    2 +-
 14 files changed, 16 insertions(+), 16 deletions(-)

-- 
1.7.4.1

CC: Mauro Carvalho Chehab <mchehab@infradead.org>
CC: Linus Walleij <linus.walleij@linaro.org>
CC: Ian Campbell <ian.campbell@citrix.com>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: Jeremy Fitzhardinge <jeremy@goop.org>
CC: Chas Williams <chas@cmf.nrl.navy.mil>
CC: Jack Steiner <steiner@sgi.com>
CC: Arnd Bergmann <arnd@arndb.de>
CC: Luciano Coelho <coelho@ti.com>
CC: Jiri Kosina <jkosina@suse.cz>
CC: ivtv-devel@ivtvdriver.org
CC: linux-media@vger.kernel.org
CC: xen-devel@lists.xensource.com
CC: netdev@vger.kernel.org
CC: virtualization@lists.linux-foundation.org
CC: linux-atm-general@lists.sourceforge.net
CC: linux-usb@vger.kernel.org
CC: linux-input@vger.kernel.org
CC: linux-wireless@vger.kernel.org

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

end of thread, other threads:[~2013-01-02 21:40 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-16  6:50 [PATCH 00/14] Modify signed comparisons of unsigned variables Tushar Behera
2012-11-16  6:50 ` [PATCH 01/14] [media] ivtv: Remove redundant check on unsigned variable Tushar Behera
2012-11-16  6:50 ` [PATCH 02/14] [media] meye: " Tushar Behera
2012-11-16  6:50 ` [PATCH 03/14] [media] saa7134: " Tushar Behera
2012-11-16  6:50 ` [PATCH 04/14] [media] tlg2300: " Tushar Behera
2012-11-16  6:50 ` [PATCH 05/14] [media] atmel-isi: Update error check for unsigned variables Tushar Behera
2012-11-17 23:16   ` Guennadi Liakhovetski
2012-11-19  3:55     ` Tushar Behera
2012-11-16  6:50 ` [PATCH 06/14] pinctrl: samsung: " Tushar Behera
2012-11-17 20:31   ` Linus Walleij
2012-11-19  1:29     ` Kukjin Kim
2012-11-16  6:50 ` [PATCH 07/14] pinctrl: SPEAr: " Tushar Behera
2012-11-16  7:05   ` viresh kumar
2012-11-23  7:34   ` Linus Walleij
2012-11-16  6:50 ` [PATCH 08/14] xen: netback: Remove redundant check on unsigned variable Tushar Behera
2012-11-16  9:16   ` Ian Campbell
2012-12-28  5:15     ` Tushar Behera
2012-12-28 10:41       ` [Xen-devel] " Wei Liu
2012-12-28 10:41         ` Wei Liu
2013-01-02 21:40         ` Konrad Rzeszutek Wilk
2012-11-16  6:50 ` [PATCH 09/14] xen: events: " Tushar Behera
2012-11-16 16:09   ` Konrad Rzeszutek Wilk
2012-11-16 16:09     ` Konrad Rzeszutek Wilk
2012-11-16 16:53     ` Jeremy Fitzhardinge
2012-11-16 16:53     ` Jeremy Fitzhardinge
2012-11-19  3:52       ` Tushar Behera
2012-11-19  3:52         ` Tushar Behera
2012-11-19 10:31         ` [Xen-devel] " Ian Campbell
2012-11-19 10:31           ` Ian Campbell
2012-11-19 11:00           ` [Xen-devel] " Tushar Behera
2012-11-19 11:00             ` Tushar Behera
2012-11-19 10:31         ` Ian Campbell
2012-11-16  6:50 ` Tushar Behera
2012-11-16  6:50 ` [PATCH 10/14] atm: Removed " Tushar Behera
2012-12-28  5:16   ` Tushar Behera
2012-12-31 15:18     ` chas williams - CONTRACTOR
2012-11-16  6:50 ` [PATCH 11/14] HID: hiddev: Remove " Tushar Behera
2012-11-16  9:27   ` Jiri Kosina
2012-11-16  6:50 ` [PATCH 12/14] gru: " Tushar Behera
2012-11-16  6:50 ` [PATCH 13/14] misc: tsl2550: " Tushar Behera
2012-11-16  8:09   ` Arnd Bergmann
2012-11-16  6:50 ` [PATCH 14/14] wlcore: " Tushar Behera
2012-11-16 18:24   ` Luciano Coelho
  -- strict thread matches above, loose matches on Subject: below --
2012-11-16  6:50 [PATCH 00/14] Modify signed comparisons of unsigned variables Tushar Behera

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.