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:	Mon, 21 Dec 2015 23:46:56 +0000
From:	Al Viro <viro@...IV.linux.org.uk>
To:	linux-kernel@...r.kernel.org
Cc:	Linus Torvalds <torvalds@...ux-foundation.org>
Subject: [POC][PATCH 23/83] fd_dma_mem_free(): pass address as void * instead of unsigned long

From: Al Viro <viro@...iv.linux.org.uk>

Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
---
 arch/m68k/include/asm/floppy.h              |  4 ++--
 arch/mips/include/asm/mach-generic/floppy.h |  4 ++--
 arch/mips/include/asm/mach-jazz/floppy.h    |  6 +++---
 arch/parisc/include/asm/floppy.h            |  6 +++---
 arch/sparc/include/asm/floppy_32.h          |  2 +-
 arch/x86/include/asm/floppy.h               |  6 +++---
 drivers/block/floppy.c                      | 10 +++++-----
 7 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/arch/m68k/include/asm/floppy.h b/arch/m68k/include/asm/floppy.h
index 47365b1..b5fb689 100644
--- a/arch/m68k/include/asm/floppy.h
+++ b/arch/m68k/include/asm/floppy.h
@@ -147,9 +147,9 @@ static unsigned long vdma_mem_alloc(unsigned long size)
 
 }
 
-static void _fd_dma_mem_free(unsigned long addr, unsigned long size)
+static void _fd_dma_mem_free(void *addr, unsigned long size)
 {
-        vfree((void *)addr);
+        vfree(addr);
 }
 #define fd_dma_mem_free(addr,size) _fd_dma_mem_free(addr, size)
 
diff --git a/arch/mips/include/asm/mach-generic/floppy.h b/arch/mips/include/asm/mach-generic/floppy.h
index 7b0b508..1419f0d 100644
--- a/arch/mips/include/asm/mach-generic/floppy.h
+++ b/arch/mips/include/asm/mach-generic/floppy.h
@@ -122,9 +122,9 @@ static inline unsigned long fd_dma_mem_alloc(unsigned long size)
 	return mem;
 }
 
-static inline void fd_dma_mem_free(unsigned long addr, unsigned long size)
+static inline void fd_dma_mem_free(void *addr, unsigned long size)
 {
-	free_pages((void *)addr, get_order(size));
+	free_pages(addr, get_order(size));
 }
 
 static inline unsigned long fd_drive_type(unsigned long n)
diff --git a/arch/mips/include/asm/mach-jazz/floppy.h b/arch/mips/include/asm/mach-jazz/floppy.h
index 4aaf35b..701dbfc 100644
--- a/arch/mips/include/asm/mach-jazz/floppy.h
+++ b/arch/mips/include/asm/mach-jazz/floppy.h
@@ -114,10 +114,10 @@ static inline unsigned long fd_dma_mem_alloc(unsigned long size)
 	return mem;
 }
 
-static inline void fd_dma_mem_free(unsigned long addr, unsigned long size)
+static inline void fd_dma_mem_free(void *addr, unsigned long size)
 {
-	vdma_free(vdma_phys2log(CPHYSADDR(addr)));
-	free_pages((void *)addr, get_order(size));
+	vdma_free(vdma_phys2log(CPHYSADDR((unsigned long)addr)));
+	free_pages(addr, get_order(size));
 }
 
 static inline unsigned long fd_drive_type(unsigned long n)
diff --git a/arch/parisc/include/asm/floppy.h b/arch/parisc/include/asm/floppy.h
index ce08762..21ea40c 100644
--- a/arch/parisc/include/asm/floppy.h
+++ b/arch/parisc/include/asm/floppy.h
@@ -177,12 +177,12 @@ static unsigned long vdma_mem_alloc(unsigned long size)
 
 #define nodma_mem_alloc(size) vdma_mem_alloc(size)
 
-static void _fd_dma_mem_free(unsigned long addr, unsigned long size)
+static void _fd_dma_mem_free(void *addr, unsigned long size)
 {
 	if((unsigned int) addr >= (unsigned int) high_memory)
-		return vfree((void *)addr);
+		return vfree(addr);
 	else
-		free_pages((void *)addr, get_order(size));		
+		free_pages(addr, get_order(size));		
 }
 
 #define fd_dma_mem_free(addr, size)  _fd_dma_mem_free(addr, size) 
diff --git a/arch/sparc/include/asm/floppy_32.h b/arch/sparc/include/asm/floppy_32.h
index 071b83e..dd7aa7c 100644
--- a/arch/sparc/include/asm/floppy_32.h
+++ b/arch/sparc/include/asm/floppy_32.h
@@ -75,7 +75,7 @@ static struct sun_floppy_ops sun_fdops;
 #define fd_free_irq()             /* nothing... */
 #if 0  /* P3: added by Alain, these cause a MMU corruption. 19960524 XXX */
 #define fd_dma_mem_alloc(size)    ((unsigned long) vmalloc(size))
-#define fd_dma_mem_free(addr,size) (vfree((void *)(addr)))
+#define fd_dma_mem_free(addr,size) (vfree((addr)))
 #endif
 
 /* XXX This isn't really correct. XXX */
diff --git a/arch/x86/include/asm/floppy.h b/arch/x86/include/asm/floppy.h
index 8203e1d..31718b2 100644
--- a/arch/x86/include/asm/floppy.h
+++ b/arch/x86/include/asm/floppy.h
@@ -165,12 +165,12 @@ static unsigned long vdma_mem_alloc(unsigned long size)
 
 #define nodma_mem_alloc(size) vdma_mem_alloc(size)
 
-static void _fd_dma_mem_free(unsigned long addr, unsigned long size)
+static void _fd_dma_mem_free(void *addr, unsigned long size)
 {
 	if ((unsigned long)addr >= (unsigned long)high_memory)
-		vfree((void *)addr);
+		vfree(addr);
 	else
-		free_pages((void *)addr, get_order(size));
+		free_pages(addr, get_order(size));
 }
 
 #define fd_dma_mem_free(addr, size)  _fd_dma_mem_free(addr, size)
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index e2738be..9f36da8 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -267,7 +267,7 @@ static int set_next_request(void);
 /* Dma Memory related stuff */
 
 #ifndef fd_dma_mem_free
-#define fd_dma_mem_free(addr, size) free_pages((void *)addr, get_order(size))
+#define fd_dma_mem_free(addr, size) free_pages(addr, get_order(size))
 #endif
 
 #ifndef fd_dma_mem_alloc
@@ -3099,7 +3099,7 @@ static void raw_cmd_free(struct floppy_raw_cmd **ptr)
 	*ptr = NULL;
 	while (this) {
 		if (this->buffer_length) {
-			fd_dma_mem_free((unsigned long)this->kernel_data,
+			fd_dma_mem_free(this->kernel_data,
 					this->buffer_length);
 			this->buffer_length = 0;
 		}
@@ -3686,7 +3686,7 @@ static int floppy_open(struct block_device *bdev, fmode_t mode)
 		}
 		if (floppy_track_buffer) {
 			if (tmp)
-				fd_dma_mem_free((unsigned long)tmp, try * 1024);
+				fd_dma_mem_free(tmp, try * 1024);
 		} else {
 			buffer_min = buffer_max = -1;
 			floppy_track_buffer = tmp;
@@ -4508,7 +4508,7 @@ static void floppy_release_irq_and_dma(void)
 	int drive;
 #endif
 	long tmpsize;
-	unsigned long tmpaddr;
+	void *tmpaddr;
 
 	if (!atomic_dec_and_test(&usage_count))
 		return;
@@ -4526,7 +4526,7 @@ static void floppy_release_irq_and_dma(void)
 
 	if (floppy_track_buffer && max_buffer_sectors) {
 		tmpsize = max_buffer_sectors * 1024;
-		tmpaddr = (unsigned long)floppy_track_buffer;
+		tmpaddr = floppy_track_buffer;
 		floppy_track_buffer = NULL;
 		max_buffer_sectors = 0;
 		buffer_min = buffer_max = -1;
-- 
2.1.4

--
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