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  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:   Sun, 25 Dec 2016 19:44:24 +0100
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     linux-media@...r.kernel.org,
        Laurent Pinchart <laurent.pinchart@...asonboard.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: [PATCH 12/19] [media] uvc_driver: Move six assignments in
 uvc_parse_streaming()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sun, 25 Dec 2016 16:25:57 +0100

Move the assignments for six local variables so that these statements
will only be executed if memory allocations succeeded by this function.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 drivers/media/usb/uvc/uvc_driver.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 5bb18a5f7d9f..d67fd5dfb335 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -634,11 +634,10 @@ static int uvc_parse_streaming(struct uvc_device *dev,
 	struct uvc_streaming *streaming;
 	struct uvc_format *format;
 	struct uvc_frame *frame;
-	struct usb_host_interface *alts = &intf->altsetting[0];
-	unsigned char *_buffer, *buffer = alts->extra;
-	int _buflen, buflen = alts->extralen;
-	unsigned int nformats = 0, nframes = 0, nintervals = 0;
-	unsigned int size, i, n, p;
+	struct usb_host_interface *alts;
+	unsigned char *_buffer, *buffer;
+	int _buflen, buflen;
+	unsigned int nformats, nframes, nintervals, size, i, n, p;
 	__u32 *interval;
 	__u16 psize;
 	int ret = -EINVAL;
@@ -670,6 +669,9 @@ static int uvc_parse_streaming(struct uvc_device *dev,
 	streaming->dev = dev;
 	streaming->intf = usb_get_intf(intf);
 	streaming->intfnum = intf->cur_altsetting->desc.bInterfaceNumber;
+	alts = &intf->altsetting[0];
+	buffer = alts->extra;
+	buflen = alts->extralen;
 
 	/* The Pico iMage webcam has its class-specific interface descriptors
 	 * after the endpoint descriptors.
@@ -759,6 +761,9 @@ static int uvc_parse_streaming(struct uvc_device *dev,
 
 	_buffer = buffer;
 	_buflen = buflen;
+	nformats = 0;
+	nframes = 0;
+	nintervals = 0;
 
 	/* Count the format and frame descriptors. */
 	while (_buflen > 2 && _buffer[1] == USB_DT_CS_INTERFACE) {
-- 
2.11.0

Powered by blists - more mailing lists