LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: vijaykhemka@fb.com
Cc: sam@mendozajonas.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org,
Justin.Lee1@Dell.com, joel@jms.id.au,
linux-aspeed@lists.ozlabs.org
Subject: Re: [PATCH net-next] net/ncsi: Add NCSI Mellanox OEM command
Date: Wed, 21 Nov 2018 16:52:44 -0800 (PST) [thread overview]
Message-ID: <20181121.165244.777667590099933299.davem@davemloft.net> (raw)
In-Reply-To: <20181120203516.3460764-1-vijaykhemka@fb.com>
From: Vijay Khemka <vijaykhemka@fb.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.
next prev parent reply other threads:[~2018-11-22 0:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-20 20:35 Vijay Khemka
2018-11-22 0:52 ` David Miller [this message]
2018-11-26 21:23 ` Vijay Khemka
-- strict thread matches above, loose matches on Subject: below --
2018-10-25 22:04 Vijay Khemka
2018-10-25 22:53 ` David Miller
2018-10-26 17:19 ` Vijay Khemka
2018-10-26 17:36 ` David Miller
2018-10-26 22:40 ` Vijay Khemka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181121.165244.777667590099933299.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=Justin.Lee1@Dell.com \
--cc=joel@jms.id.au \
--cc=linux-aspeed@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=openbmc@lists.ozlabs.org \
--cc=sam@mendozajonas.com \
--cc=vijaykhemka@fb.com \
--subject='Re: [PATCH net-next] net/ncsi: Add NCSI Mellanox OEM command' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).