[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <D0F6A4CE-9BBB-45E2-8915-D02438FBFAB8@fb.com>
Date: Mon, 26 Nov 2018 21:23:10 +0000
From: Vijay Khemka <vijaykhemka@...com>
To: David Miller <davem@...emloft.net>
CC: "sam@...dozajonas.com" <sam@...dozajonas.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"openbmc@...ts.ozlabs.org" <openbmc@...ts.ozlabs.org>,
"Justin.Lee1@...l.com" <Justin.Lee1@...l.com>,
"joel@....id.au" <joel@....id.au>,
"linux-aspeed@...ts.ozlabs.org" <linux-aspeed@...ts.ozlabs.org>
Subject: Re: [PATCH net-next] net/ncsi: Add NCSI Mellanox OEM command
Thanks David,
I will fix this and upload next version.
Regards
-Vijay
On 11/21/18, 4:55 PM, "David Miller" <davem@...emloft.net> wrote:
From: Vijay Khemka <vijaykhemka@...com>
Date: Tue, 20 Nov 2018 12:35:16 -0800
> +static int ncsi_oem_gma_handler_mlx(struct ncsi_cmd_arg *nca)
> +{
> + unsigned char data[NCSI_OEM_MLX_CMD_GMA_LEN];
> + int ret = 0;
> +
> + nca->payload = NCSI_OEM_MLX_CMD_GMA_LEN;
> +
> + memset(data, 0, NCSI_OEM_MLX_CMD_GMA_LEN);
> + *(unsigned int *)data = ntohl(NCSI_OEM_MFR_MLX_ID);
'data' is not necessarily aligned on an unsigned int boundary.
But second of all you want to use a fixed size type like "u32" or
similar here, not "unsigned int".
Altogether, something like:
union {
u8 data_u8[NCSI_OEM_MLX_CMD_GMA_LEN];
u32 data_u32[[NCSI_OEM_MLX_CMD_GMA_LEN / sizeof(u32)];
} u;
memset(&u, 0, sizeof(u));
u.data_u32[0] = ntohl(NCSI_OEM_MFR_MLX_ID);
u.data_u8[5] = NCSI_OEM_MLX_CMD_GMA;
u.data_u8[6] = NCSI_OEM_MLX_CMD_GMA_PARAM;
If the rest of the ncsi driver has crud like this, it all needs
to be fixed up similarly.
Powered by blists - more mailing lists