[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <54BE8615.7070708@collabora.co.uk>
Date: Tue, 20 Jan 2015 17:45:09 +0100
From: Javier Martinez Canillas <javier.martinez@...labora.co.uk>
To: Lee Jones <lee.jones@...aro.org>
CC: Olof Johansson <olof@...om.net>,
Doug Anderson <dianders@...omium.org>,
Bill Richardson <wfrichar@...omium.org>,
Simon Glass <sjg@...gle.com>,
Gwendal Grignou <gwendal@...gle.com>,
Jonathan Corbet <corbet@....net>,
linux-samsung-soc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH RESEND v2 2/7] mfd: cros_ec: Add char dev and virtual
dev pointers
Hello Lee,
On 01/20/2015 05:36 PM, Lee Jones wrote:
>> >
>> > Is this safe? Are you sure it's okay to provide an interface from
>> > userspace to read (kernel?) memory?
>> >
>>
>> This interface is not to read any kernel memory but only the memory mapped
>> I/O region for the Low Pin Count (LPC) bus. So user-space only can choose
>> and offset and a number of bytes using the CROS_EC_DEV_IOCRDMEM ioctl cmd
>> which uses the following structure as argument:
>>
>> /*
>> * @offset: within EC_LPC_ADDR_MEMMAP region
>> * @bytes: number of bytes to read. zero means "read a string" (including '\0')
>> * (at most only EC_MEMMAP_SIZE bytes can be read)
>> * @buffer: where to store the result
>> * ioctl returns the number of bytes read, negative on error
>> */
>> struct cros_ec_readmem {
>> uint32_t offset;
>> uint32_t bytes;
>> uint8_t buffer[EC_MEMMAP_SIZE];
>> };
>>
>> The cros_ec_lpc_readmem() handler that the function pointer is set only
>> reads bytes from EC_LPC_ADDR_MEMMAP + offset if offset < EC_MEMMAP_SIZE
>> and the data is copied to the user-space buffer from the structure passed
>> as argument with copy_to_user().
>>
>> So in that sense is similar to the spidev or i2c-dev interfaces that are
>> used to access these buses from user-space.
>
> Very well. The purpose of my question was to be provocative and to
> make you think about the interface. As long as you're sure it can't
> be abused, then I'm happy.
>
Ok, thanks a lot. Does it mean I've your Acked-by for this patch too?
Best regards,
Javier
--
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