[PATCH linux dev-4.7] drivers: fsi: Copy all data out

Edward James eajames at us.ibm.com
Tue Feb 21 09:51:56 AEDT 2017



Milton Miller II/Austin/IBM wrote on 02/20/2017 04:33:24 PM:

> From: Milton Miller II/Austin/IBM
> To: Eddie James <eajames at linux.vnet.ibm.com>
> Cc: openbmc at lists.ozlabs.org, joel at jms.id.au, Edward
James/Austin/IBM at IBMUS
> Date: 02/20/2017 04:33 PM
> Subject: Re: [PATCH linux dev-4.7] drivers: fsi: Copy all data out
>
>
>
> -----"openbmc" <openbmc-bounces+miltonm=us.ibm.com at lists.ozlabs.org>
> wrote: -----
> >From: Eddie James
> >Date: 02/20/2017 03:06PM
> >
> >From: "Edward A. James" <eajames at us.ibm.com>
> >
> >Driver was only copying 32 bits out to the user-provided data
> >pointer.
> >
> >Signed-off-by: Edward A. James <eajames at us.ibm.com>
> >---
> > drivers/fsi/fsi-master-gpio.c | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
> >
> >diff --git a/drivers/fsi/fsi-master-gpio.c
> >b/drivers/fsi/fsi-master-gpio.c
> >index 3ed82ea..3eb6ec2 100644
> >--- a/drivers/fsi/fsi-master-gpio.c
> >+++ b/drivers/fsi/fsi-master-gpio.c
> >@@ -203,7 +203,7 @@ static void fsi_master_gpio_error(struct
> >fsi_master_gpio *master, int error)
> > static int poll_for_response(struct fsi_master_gpio *master, uint8_t
> >expected,
> >          uint8_t size, void *data)
> > {
> >-   int busy_count = 0, i;
> >+   int busy_count = 0, i, j;
> >    struct fsi_gpio_msg response, cmd;
> >    int bits_remaining = 0, bit_count, response_id, id;
> >    uint64_t resp = 0;
> >@@ -274,7 +274,8 @@ static int poll_for_response(struct
> >fsi_master_gpio *master, uint8_t expected,
> >          resp <<= bits_remaining;
> >          resp |= response.msg;
> >          bits_received += bits_remaining;
> >-         *((uint32_t *)data) = response.msg;
> >+         for (j = 0; j < size; ++j)
> >+            ((uint8_t *)data)[j] = ((uint8_t *)&response.msg)[j];
>
> A lot of casting for memcpy(data, &response.msg, size);

Ugh, thanks. I was experimenting switching the byte order and didn't
switch it back to something sensible... v2 on the way.

Eddie

>
> >       }
> >
> >       crc_in = fsi_crc4(0, resp | (0x1ULL << bits_received),
> >--
> >1.8.3.1
>
> milton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20170220/3adf186b/attachment-0001.html>


More information about the openbmc mailing list