All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 18/23] aty: use memory_read_from_buffer
       [not found] <20080601150017.176540188@gmail.com>
@ 2008-06-01 15:00 ` Akinobu, Mita <akinobu.mita
  2008-06-01 15:13 ` [Ocfs2-devel] [patch 03/23] ocfs2: use simple_read_from_buffer Akinobu Mita
       [not found] ` <20080601150114.022504880@gmail.com>
  2 siblings, 0 replies; 4+ messages in thread
From: Akinobu, Mita <akinobu.mita @ 2008-06-01 15:00 UTC (permalink / raw)
  To: linux-kernel; +Cc: Benjamin Herrenschmidt, linux-fbdev-devel

[-- Attachment #1: aty-use-memory-read-from-buffer.patch --]
[-- Type: text/plain, Size: 1265 bytes --]

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linux-fbdev-devel@lists.sourceforge.net
---
 drivers/video/aty/radeon_base.c |   11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

Index: 2.6-git/drivers/video/aty/radeon_base.c
===================================================================
--- 2.6-git.orig/drivers/video/aty/radeon_base.c
+++ 2.6-git/drivers/video/aty/radeon_base.c
@@ -70,6 +70,7 @@
 #include <linux/pci.h>
 #include <linux/vmalloc.h>
 #include <linux/device.h>
+#include <linux/fs.h>
 
 #include <asm/io.h>
 #include <linux/uaccess.h>
@@ -2098,15 +2099,7 @@ static void radeon_identify_vram(struct 
 
 static ssize_t radeon_show_one_edid(char *buf, loff_t off, size_t count, const u8 *edid)
 {
-	if (off > EDID_LENGTH)
-		return 0;
-
-	if (off + count > EDID_LENGTH)
-		count = EDID_LENGTH - off;
-
-	memcpy(buf, edid + off, count);
-
-	return count;
+	return memory_read_from_buffer(buf, count, &off, edid, EDID_LENGTH);
 }
 
 

-- 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Ocfs2-devel] [patch 03/23] ocfs2: use simple_read_from_buffer
       [not found] <20080601150017.176540188@gmail.com>
  2008-06-01 15:00 ` [patch 18/23] aty: use memory_read_from_buffer Akinobu, Mita <akinobu.mita
@ 2008-06-01 15:13 ` Akinobu Mita
       [not found] ` <20080601150114.022504880@gmail.com>
  2 siblings, 0 replies; 4+ messages in thread
From: Akinobu Mita @ 2008-06-01 15:13 UTC (permalink / raw)
  To: ocfs2-devel

An embedded and charset-unspecified text was scrubbed...
Name: ocfs2-use-simple-read-from-buffer.patch
Url: http://oss.oracle.com/pipermail/ocfs2-devel/attachments/20080601/8e47b072/attachment.pl 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch 05/23] isdn: use simple_read_from_buffer
       [not found] ` <20080601150114.022504880@gmail.com>
@ 2008-06-01 16:09   ` Karsten Keil
  2008-06-01 16:15   ` Karsten Keil
  1 sibling, 0 replies; 4+ messages in thread
From: Karsten Keil @ 2008-06-01 16:09 UTC (permalink / raw)
  To: Akinobu, "Mita <akinobu.mita"; +Cc: linux-kernel, Andrew Morton

On Mon, Jun 02, 2008 at 12:00:22AM +0900, Akinobu@suse.de wrote:
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>

Acked-by: Karsten Keil <kkeil@suse.de>

> Cc: Karsten Keil <kkeil@suse.de>
> ---
>  drivers/isdn/hysdn/hysdn_procconf.c |   27 +++++++--------------------
>  1 file changed, 7 insertions(+), 20 deletions(-)
> 
> Index: 2.6-git/drivers/isdn/hysdn/hysdn_procconf.c
> ===================================================================
> --- 2.6-git.orig/drivers/isdn/hysdn/hysdn_procconf.c
> +++ 2.6-git/drivers/isdn/hysdn/hysdn_procconf.c
> @@ -207,30 +207,17 @@ hysdn_conf_write(struct file *file, cons
>  /* read conf file -> output card info data */
>  /*******************************************/
>  static ssize_t
> -hysdn_conf_read(struct file *file, char __user *buf, size_t count, loff_t * off)
> +hysdn_conf_read(struct file *file, char __user *buf, size_t count, loff_t *off)
>  {
>  	char *cp;
> -	int i;
>  
> -	if (file->f_mode & FMODE_READ) {
> -		if (!(cp = file->private_data))
> -			return (-EFAULT);	/* should never happen */
> -		i = strlen(cp);	/* get total string length */
> -		if (*off < i) {
> -			/* still bytes to transfer */
> -			cp += *off;	/* point to desired data offset */
> -			i -= *off;	/* remaining length */
> -			if (i > count)
> -				i = count;	/* limit length to transfer */
> -			if (copy_to_user(buf, cp, i))
> -				return (-EFAULT);	/* copy error */
> -			*off += i;	/* adjust offset */
> -		} else
> -			return (0);
> -	} else
> -		return (-EPERM);	/* no permission to read */
> +	if (!(file->f_mode & FMODE_READ))
> +		return -EPERM;	/* no permission to read */
>  
> -	return (i);
> +	if (!(cp = file->private_data))
> +		return -EFAULT;	/* should never happen */
> +
> +	return simple_read_from_buffer(buf, count, off, cp, strlen(cp));
>  }				/* hysdn_conf_read */
>  
>  /******************/
> 
> -- 

-- 
Karsten Keil
SuSE Labs
ISDN and VOIP development
SUSE LINUX Products GmbH, Maxfeldstr.5 90409 Nuernberg, GF: Markus Rex, HRB 16746 (AG Nuernberg)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch 05/23] isdn: use simple_read_from_buffer
       [not found] ` <20080601150114.022504880@gmail.com>
  2008-06-01 16:09   ` [patch 05/23] isdn: " Karsten Keil
@ 2008-06-01 16:15   ` Karsten Keil
  1 sibling, 0 replies; 4+ messages in thread
From: Karsten Keil @ 2008-06-01 16:15 UTC (permalink / raw)
  To: Akinobu Mita; +Cc: linux-kernel, Andrew Morton

On Mon, Jun 02, 2008 at 12:00:22AM +0900, Akinobu@suse.de wrote:
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>

Acked-by: Karsten Keil <kkeil@suse.de>

> Cc: Karsten Keil <kkeil@suse.de>
> ---
>  drivers/isdn/hysdn/hysdn_procconf.c |   27 +++++++--------------------
>  1 file changed, 7 insertions(+), 20 deletions(-)
> 
> Index: 2.6-git/drivers/isdn/hysdn/hysdn_procconf.c
> ===================================================================
> --- 2.6-git.orig/drivers/isdn/hysdn/hysdn_procconf.c
> +++ 2.6-git/drivers/isdn/hysdn/hysdn_procconf.c
> @@ -207,30 +207,17 @@ hysdn_conf_write(struct file *file, cons
>  /* read conf file -> output card info data */
>  /*******************************************/
>  static ssize_t
> -hysdn_conf_read(struct file *file, char __user *buf, size_t count, loff_t * off)
> +hysdn_conf_read(struct file *file, char __user *buf, size_t count, loff_t *off)
>  {
>  	char *cp;
> -	int i;
>  
> -	if (file->f_mode & FMODE_READ) {
> -		if (!(cp = file->private_data))
> -			return (-EFAULT);	/* should never happen */
> -		i = strlen(cp);	/* get total string length */
> -		if (*off < i) {
> -			/* still bytes to transfer */
> -			cp += *off;	/* point to desired data offset */
> -			i -= *off;	/* remaining length */
> -			if (i > count)
> -				i = count;	/* limit length to transfer */
> -			if (copy_to_user(buf, cp, i))
> -				return (-EFAULT);	/* copy error */
> -			*off += i;	/* adjust offset */
> -		} else
> -			return (0);
> -	} else
> -		return (-EPERM);	/* no permission to read */
> +	if (!(file->f_mode & FMODE_READ))
> +		return -EPERM;	/* no permission to read */
>  
> -	return (i);
> +	if (!(cp = file->private_data))
> +		return -EFAULT;	/* should never happen */
> +
> +	return simple_read_from_buffer(buf, count, off, cp, strlen(cp));
>  }				/* hysdn_conf_read */
>  
>  /******************/
> 
> -- 

-- 
Karsten Keil
SuSE Labs
ISDN and VOIP development
SUSE LINUX Products GmbH, Maxfeldstr.5 90409 Nuernberg, GF: Markus Rex, HRB 16746 (AG Nuernberg)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-06-01 16:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20080601150017.176540188@gmail.com>
2008-06-01 15:00 ` [patch 18/23] aty: use memory_read_from_buffer Akinobu, Mita <akinobu.mita
2008-06-01 15:13 ` [Ocfs2-devel] [patch 03/23] ocfs2: use simple_read_from_buffer Akinobu Mita
     [not found] ` <20080601150114.022504880@gmail.com>
2008-06-01 16:09   ` [patch 05/23] isdn: " Karsten Keil
2008-06-01 16:15   ` Karsten Keil

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.