Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp710779imu; Thu, 22 Nov 2018 04:18:02 -0800 (PST) X-Google-Smtp-Source: AJdET5ci9uJ8BuX/DFdoQi58b1+WlAh+A1HpZvQzHSZkDqWbF74zXU6ImKGJ4smhshMqdxdHRKhh X-Received: by 2002:aa7:8497:: with SMTP id u23mr11159927pfn.220.1542889082104; Thu, 22 Nov 2018 04:18:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542889082; cv=none; d=google.com; s=arc-20160816; b=DiJxOJwbGYWxuW7sXSbyuBDLKsLJ0uuqI+EqdXtdkIaiXME1AWJwgvdFfbofq3xJkM jVQ+Sunj2VZ3odx+hMP9iOQHXMOTp/aWULsroZy1Q8JBUQyIfQGT8mTXMlg2f4UlDeSL lnHs5qSPzNa+rgb0Jjsex8+UaaDq5Q766Xfnjx9z8UqOuaRJknWDAZ8qqi7v5n5OO57A UichnuNECgs6AzsWMqd48gIX8ztZA2Moy7VmYO1G7BqFefQBQFC/cbo5AgS0Q9TsAWU4 YqW8g+mVDiu2RRdWJHU3+XdEJlfij1Tq3LQogAdUgkHrz/2xNo0lH/bbR+SNZEDct1vv 7ZIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=LEO6lBL60xdiIvUKAICj6Tf/KJvm6ZuWCRoSnOr1HKg=; b=LT3jBCo2G4es5zdaFrp2ACRvI3/EoFbLcJ+1fBzqJfo9C5GOpAwcgHIrPtTpA8H6Nu QBKInY+ulG/MIOsMDhdJkbLlPMKkhfWwB6f55XFIe4cyZPk4LW5hH5zhkc6rr25tEJ0O se4bSoIr50QB4QFPDsOYUmrih+1S7UP1RtHgc+Mx7Zi7jeEkLNQxbucuz03OldqLmyCJ /K4fNoK10FDsPFYS6yHyz77j8/MBJKlgE0LdRQBEL6BOirxdO289ZzyKCxfswZ4FGIBP nxJO3WiPWmqfCJ2/ZJuALlze2pWNj0rETxSSpz5BuMynrYcnSlgTYkd9F+v0SD7JfBcN Hljg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i12si34012884pgq.466.2018.11.22.04.17.47; Thu, 22 Nov 2018 04:18:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391164AbeKVLbh (ORCPT + 99 others); Thu, 22 Nov 2018 06:31:37 -0500 Received: from shards.monkeyblade.net ([23.128.96.9]:48870 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730678AbeKVLbh (ORCPT ); Thu, 22 Nov 2018 06:31:37 -0500 Received: from localhost (unknown [IPv6:2601:601:9f80:35cd::bf5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 1096514E06F63; Wed, 21 Nov 2018 16:54:47 -0800 (PST) Date: Wed, 21 Nov 2018 16:52:44 -0800 (PST) Message-Id: <20181121.165244.777667590099933299.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 From: David Miller In-Reply-To: <20181120203516.3460764-1-vijaykhemka@fb.com> References: <20181120203516.3460764-1-vijaykhemka@fb.com> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Wed, 21 Nov 2018 16:54:47 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vijay Khemka 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.