lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 14 Sep 2017 12:36:22 +0200
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     linux-media@...r.kernel.org,
        Arvind Yadav <arvind.yadav.cs@...il.com>,
        Hans Verkuil <hans.verkuil@...co.com>,
        Laurent Pinchart <laurent.pinchart@...asonboard.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Sakari Ailus <sakari.ailus@...ux.intel.com>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: [PATCH 6/8] [media] ttusb_dec: Reduce the scope for three variables
 in ttusb_dec_process_urb()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Wed, 13 Sep 2017 21:23:29 +0200

* Move the definition for the local variables "b", "d" and "length" into
  an if branch so that the corresponding setting will only be performed
  if a memory allocation succeeded in this function.

* Adjust their data types.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 drivers/media/usb/ttusb-dec/ttusb_dec.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/media/usb/ttusb-dec/ttusb_dec.c b/drivers/media/usb/ttusb-dec/ttusb_dec.c
index 7759de653ee9..e9fe4c6142a5 100644
--- a/drivers/media/usb/ttusb-dec/ttusb_dec.c
+++ b/drivers/media/usb/ttusb-dec/ttusb_dec.c
@@ -812,19 +812,18 @@ static void ttusb_dec_process_urb(struct urb *urb)
 		int i;
 
 		for (i = 0; i < FRAMES_PER_ISO_BUF; i++) {
-			struct usb_iso_packet_descriptor *d;
-			u8 *b;
-			int length;
 			struct urb_frame *frame;
 
-			d = &urb->iso_frame_desc[i];
-			b = urb->transfer_buffer + d->offset;
-			length = d->actual_length;
-
 			frame = kmalloc(sizeof(*frame), GFP_ATOMIC);
 			if (frame) {
 				unsigned long flags;
+				struct usb_iso_packet_descriptor const *d;
+				u8 const *b;
+				unsigned int length;
 
+				d = &urb->iso_frame_desc[i];
+				b = urb->transfer_buffer + d->offset;
+				length = d->actual_length;
 				memcpy(frame->data, b, length);
 				frame->length = length;
 
-- 
2.14.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ