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

Milton Miller II miltonm at us.ibm.com
Tue Feb 21 09:33:24 AEDT 2017



-----"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);

> 		}
> 
> 		crc_in = fsi_crc4(0, resp | (0x1ULL << bits_received),
>-- 
>1.8.3.1

milton



More information about the openbmc mailing list