Re: [RFC 1/3] ramfs: add foofs for testing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 28, 2014 at 08:44:26AM +0100, Alexander Aring wrote:
> Signed-off-by: Alexander Aring <alex.aring@xxxxxxxxx>
> ---
>  fs/ramfs.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 69 insertions(+)
> 
> diff --git a/fs/ramfs.c b/fs/ramfs.c
> index f45a454..4b93c2e 100644
> --- a/fs/ramfs.c
> +++ b/fs/ramfs.c
> @@ -608,6 +608,48 @@ static int ramfs_probe(struct device_d *dev)
>  	return 0;
>  }
>  
> +static int foofs_read(struct device_d *_dev, FILE *f, void *buf, size_t insize)
> +{
> +	if (f->pos == strlen("Hello World!\n"))
> +		return 0;
> +
> +	return sprintf(buf, "%s", "Hello World!\n");
> +}

You should never read more bytes than insize. This is also true for
insize == 0. Implement this correctly and you'll see that your patches
do not solve the problem.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux