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] [day] [month] [year] [list]
Date:	Sat, 12 Sep 2009 23:36:09 +0800
From:	Wu Fengguang <fengguang.wu@...el.com>
To:	Daniel Walker <dwalker@...o99.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Andi Kleen <ak@...ux.intel.com>, Avi Kivity <avi@...ranet.com>,
	Greg Kroah-Hartman <gregkh@...e.de>,
	Johannes Berg <johannes@...solutions.net>,
	Marcelo Tosatti <mtosatti@...hat.com>,
	Mark Brown <broonie@...nsource.wolfsonmicro.com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/3] devmem: remove redundant parameter from
	do_write_kmem()

On Sat, Sep 12, 2009 at 11:30:54PM +0800, Daniel Walker wrote:
> On Sat, 2009-09-12 at 23:20 +0800, Wu Fengguang wrote:
> >  static inline ssize_t
> > -do_write_kmem(void *p, unsigned long realp, const char __user * buf,
> > +do_write_kmem(unsigned long p, const char __user * buf,
> >               size_t count, loff_t *ppos)
> >  {
> 
> There's one style issue in the block above. Could you run your patches
> through checkpatch and fix whatever errors it reports?

Thanks for catching it!  Here is the updated patch.
(I ran checkpatch against the first two bugs but forgot this last one..)

--
devmem: remove redundant parameter from do_write_kmem()

Cc: Andi Kleen <ak@...ux.intel.com>
Cc: Avi Kivity <avi@...ranet.com>
Cc: Greg Kroah-Hartman <gregkh@...e.de>
Cc: Johannes Berg <johannes@...solutions.net>
Cc: Marcelo Tosatti <mtosatti@...hat.com>
Cc: Mark Brown <broonie@...nsource.wolfsonmicro.com>
Cc: Daniel Walker <dwalker@...o99.com>
Signed-off-by: Wu Fengguang <fengguang.wu@...el.com>
---
 drivers/char/mem.c |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

--- linux-mm.orig/drivers/char/mem.c	2009-09-12 23:17:12.000000000 +0800
+++ linux-mm/drivers/char/mem.c	2009-09-12 23:35:18.000000000 +0800
@@ -465,7 +465,7 @@ static ssize_t read_kmem(struct file *fi
 
 
 static inline ssize_t
-do_write_kmem(void *p, unsigned long realp, const char __user * buf,
+do_write_kmem(unsigned long p, const char __user *buf,
 	      size_t count, loff_t *ppos)
 {
 	ssize_t written, sz;
@@ -474,12 +474,11 @@ do_write_kmem(void *p, unsigned long rea
 	written = 0;
 #ifdef __ARCH_HAS_NO_PAGE_ZERO_MAPPED
 	/* we don't have page 0 mapped on sparc and m68k.. */
-	if (realp < PAGE_SIZE) {
-		sz = size_inside_page(realp, count);
+	if (p < PAGE_SIZE) {
+		sz = size_inside_page(p, count);
 		/* Hmm. Do something? */
 		buf += sz;
 		p += sz;
-		realp += sz;
 		count -= sz;
 		written += sz;
 	}
@@ -488,14 +487,14 @@ do_write_kmem(void *p, unsigned long rea
 	while (count > 0) {
 		char *ptr;
 
-		sz = size_inside_page(realp, count);
+		sz = size_inside_page(p, count);
 
 		/*
 		 * On ia64 if a page has been mapped somewhere as
 		 * uncached, then it must also be accessed uncached
 		 * by the kernel or data corruption may occur
 		 */
-		ptr = xlate_dev_kmem_ptr(p);
+		ptr = xlate_dev_kmem_ptr((char *)p);
 
 		copied = copy_from_user(ptr, buf, sz);
 		if (copied) {
@@ -506,7 +505,6 @@ do_write_kmem(void *p, unsigned long rea
 		}
 		buf += sz;
 		p += sz;
-		realp += sz;
 		count -= sz;
 		written += sz;
 	}
@@ -530,7 +528,7 @@ static ssize_t write_kmem(struct file * 
 	if (p < (unsigned long) high_memory) {
 		unsigned long to_write = min_t(unsigned long, count,
 					       (unsigned long)high_memory - p);
-		wrote = do_write_kmem((void *)p, p, buf, to_write, ppos);
+		wrote = do_write_kmem(p, buf, to_write, ppos);
 		if (wrote != to_write)
 			return wrote;
 		p += wrote;
--
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