LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Vijay Khemka <vijaykhemka@fb.com>
To: David Miller <davem@davemloft.net>
Cc: "sam@mendozajonas.com" <sam@mendozajonas.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"openbmc@lists.ozlabs.org" <openbmc@lists.ozlabs.org>,
	"Justin.Lee1@Dell.com" <Justin.Lee1@Dell.com>,
	"joel@jms.id.au" <joel@jms.id.au>,
	"linux-aspeed@lists.ozlabs.org" <linux-aspeed@lists.ozlabs.org>
Subject: Re: [PATCH net-next] net/ncsi: Add NCSI Mellanox OEM command
Date: Mon, 26 Nov 2018 21:23:10 +0000	[thread overview]
Message-ID: <D0F6A4CE-9BBB-45E2-8915-D02438FBFAB8@fb.com> (raw)
In-Reply-To: <20181121.165244.777667590099933299.davem@davemloft.net>

Thanks David,
I will fix this and upload next version.

Regards
-Vijay

On 11/21/18, 4:55 PM, "David Miller" <davem@davemloft.net> wrote:

    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.
    


  reply	other threads:[~2018-11-26 21:23 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
2018-11-26 21:23   ` Vijay Khemka [this message]
  -- 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=D0F6A4CE-9BBB-45E2-8915-D02438FBFAB8@fb.com \
    --to=vijaykhemka@fb.com \
    --cc=Justin.Lee1@Dell.com \
    --cc=davem@davemloft.net \
    --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 \
    --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).