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-next>] [day] [month] [year] [list]
Message-ID: <20170708004054.GA27142@amitoj-Inspiron-3542>
Date:   Fri, 7 Jul 2017 20:40:54 -0400
From:   Amitoj Kaur Chawla <amitoj1606@...il.com>
To:     mchehab@...nel.org, gregkh@...uxfoundation.org,
        linux-media@...r.kernel.org, devel@...verdev.osuosl.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH 1/2] staging: media: atomisp2: css2400: Replace
 kfree()/vfree() with kvfree()

Conditionally calling kfree()/vfree() can be replaced by a call to 
kvfree() which handles both kmalloced memory and vmalloced memory.

The Coccinelle semantic patch used to make the change is as follows:
//<smpl>
@@
expression a;
@@
- if(...) { vfree(a); }
- else { kfree(a); }
+ kvfree(a);
@@
expression a;
@@
- if(...) { kfree(a); }
- else { vfree(a); }
+ kvfree(a);
// </smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@...il.com>
---
 drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
index 73c7658..1b0708f 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c
@@ -2029,10 +2029,7 @@ void *sh_css_calloc(size_t N, size_t size)
 
 void sh_css_free(void *ptr)
 {
-	if (is_vmalloc_addr(ptr))
-		vfree(ptr);
-	else
-		kfree(ptr);
+	kvfree(ptr);
 }
 
 /* For Acceleration API: Flush FW (shared buffer pointer) arguments */
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ