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


Groups > linux.kernel > #1497396

[PATCH 21/26] pctv452e: don't call BUG_ON() on non-fatal error

From Mauro Carvalho Chehab <mchehab@s-opensource.com>
Newsgroups linux.kernel
Subject [PATCH 21/26] pctv452e: don't call BUG_ON() on non-fatal error
Date 2016-10-07 19:30 +0200
Message-ID <spH85-3EG-31@gated-at.bofh.it> (permalink)
References <spH85-3EG-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


There are some conditions on this driver that are tested with
BUG_ON() with are not serious enough to hang a machine.

So, just return an error if this happens.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
---
 drivers/media/usb/dvb-usb/pctv452e.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/media/usb/dvb-usb/pctv452e.c b/drivers/media/usb/dvb-usb/pctv452e.c
index 855fe9d34b59..14bd927c50d8 100644
--- a/drivers/media/usb/dvb-usb/pctv452e.c
+++ b/drivers/media/usb/dvb-usb/pctv452e.c
@@ -109,9 +109,11 @@ static int tt3650_ci_msg(struct dvb_usb_device *d, u8 cmd, u8 *data,
 	unsigned int rlen;
 	int ret;
 
-	BUG_ON(NULL == data && 0 != (write_len | read_len));
-	BUG_ON(write_len > 64 - 4);
-	BUG_ON(read_len > 64 - 4);
+	if (NULL == data && 0 != (write_len | read_len) ||
+	    write_len > 64 - 4) || (read_len > 64 - 4)) {
+		ret = -EIO;
+		goto failed;
+	};
 
 	id = state->c++;
 
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/26] Don't use stack for DMA transers on dvb-usb drivers Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-07 19:30 +0200
  [PATCH 21/26] pctv452e: don't call BUG_ON() on non-fatal error Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-07 19:30 +0200
    [PATCH v2 21/26] pctv452e: don't call BUG_ON() on non-fatal error Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-08 12:20 +0200
  [PATCH 26/26] digitv: handle error code on RC query Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-07 19:30 +0200
  [PATCH 06/26] cxusb: don't do DMA on stack Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-07 19:30 +0200
    Re: [PATCH 06/26] cxusb: don't do DMA on stack Patrick Boettcher <patrick.boettcher@posteo.de> - 2016-10-10 08:40 +0200
  [PATCH 01/26] af9005: don't do DMA on stack Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-07 19:30 +0200
  [PATCH 11/26] digitv: don't do DMA on stack Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-07 19:30 +0200
    Re: [PATCH 11/26] digitv: don't do DMA on stack Patrick Boettcher <patrick.boettcher@posteo.de> - 2016-10-10 08:40 +0200
  [PATCH 02/26] cinergyT2-core: don't do DMA on stack Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-07 19:30 +0200
    Re: [PATCH 02/26] cinergyT2-core: don't do DMA on stack Patrick Boettcher <patrick.boettcher@posteo.de> - 2016-10-10 08:40 +0200
  [PATCH 15/26] dtt200u: handle USB control message errors Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-07 19:30 +0200
  [PATCH 14/26] dtt200u: don't do DMA on stack Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-07 19:30 +0200
    Re: [PATCH 14/26] dtt200u: don't do DMA on stack Patrick Boettcher <patrick.boettcher@posteo.de> - 2016-10-10 08:40 +0200
  [PATCH 04/26] cinergyT2-fe: cache stats at cinergyt2_fe_read_status() Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-07 19:30 +0200
  [PATCH 18/26] gp8psk: don't go past the buffer size Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-07 19:30 +0200
  [PATCH 07/26] dib0700: be sure that dib0700_ctrl_rd() users can do DMA Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-07 19:40 +0200
    Re: [PATCH 07/26] dib0700: be sure that dib0700_ctrl_rd() users can  do DMA Patrick Boettcher <patrick.boettcher@posteo.de> - 2016-10-10 08:40 +0200
  [PATCH 17/26] gp8psk: don't do DMA on stack Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-07 19:40 +0200
  [PATCH 23/26] dvb-usb: warn if return value for USB read/write routines is not checked Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-10-07 19:40 +0200

csiph-web