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>] [day] [month] [year] [list]
Message-ID: <g2hl81$btp$1@ger.gmane.org>
Date:	Mon, 09 Jun 2008 00:08:00 +0200
From:	JAILLET Christophe <jaillet.christophe@...adoo.fr>
To:	linux-kernel@...r.kernel.org
Subject:  [PATCH 1/1] drivers/media/video/videobuf-dma-sg.c: avoid to clear
 memory twice

From: Christophe Jaillet <jaillet.christophe@...adoo.fr>

Hi, here is a patch against linux/drivers/usb/atm/cxacru.c which :

1) Remove a useless initialisation of 'i'
2) Avoid to clear the memory allocated twice (once in 'kcalloc', once in 
'sg_init_table')
3) Remove a test that can never trigger. The function returns NULL in 
such a case, so we know that at this point 'pages[0]' != NULL


Signed-off-by: Christophe Jaillet <jaillet.christophe@...adoo.fr>

---

diff --git a/drivers/media/video/videobuf-dma-sg.c
b/drivers/media/video/videobuf-dma-sg.c
index 03a7b94..8ed6082 100644
--- a/drivers/media/video/videobuf-dma-sg.c
+++ b/drivers/media/video/videobuf-dma-sg.c
@@ -80,17 +80,15 @@ struct scatterlist*
  videobuf_pages_to_sg(struct page **pages, int nr_pages, int offset)
  {
         struct scatterlist *sglist;
-       int i = 0;
+       int i;

         if (NULL == pages[0])
                 return NULL;
-       sglist = kcalloc(nr_pages, sizeof(*sglist), GFP_KERNEL);
+       sglist = kmalloc(nr_pages * sizeof(*sglist), GFP_KERNEL);
         if (NULL == sglist)
                 return NULL;
         sg_init_table(sglist, nr_pages);

-       if (NULL == pages[0])
-               goto nopage;
         if (PageHighMem(pages[0]))
                 /* DMA to highmem pages might not work */
                 goto highmem;

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ