Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2695104rdb; Mon, 4 Dec 2023 05:13:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IH2hQ8AecyeVwWlM9ZKCH50Ah5ViBC64yv2fmX7GWbymlkNmNKaJn+Zj4a+4v9fVCJGOynS X-Received: by 2002:a05:6a20:7d8d:b0:18b:51e:e711 with SMTP id v13-20020a056a207d8d00b0018b051ee711mr1665904pzj.13.1701695595958; Mon, 04 Dec 2023 05:13:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701695595; cv=none; d=google.com; s=arc-20160816; b=Zs1Qqb6WbVlsV7+0hyUsjs0n8oThiTtuv9V7fd1O26vE26jlcOdQvh5ppTovW0FhPq kjuEW5Ml2xJI9TvkM0VCsBBV8BJ33jbqqISR0cWRLEmhmZv5XQ1dEB7d2/eyqRduOxdI 9dB7/lhRPpAyk6dfhjeXhSfBn4K4qTtr3vQuJjWIV3LZp3hV3fg8CwkipF3iRsxDQ1ud gsREo/o2G2kqOgt4POyah78oPwCsgaQy8ASpXjeggo6kTWUj91482nEvZgDEvQYprTZ+ 2/NkbGISDe8TNZxAZyJ+HJ50jTgTrtPYBOoFE9iC3stOE9sP5R1kl8K6LkYMA1G6nmqr fSvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=YEZs6AO2flglBsYRf33FcA1+MeCcJm84o+twFj/3LKE=; fh=3/TDM0VKyeEwR/D51+Id+IFBXV+CnuDpYD6ip4jz1wE=; b=kKXYx8dIjqFSv5pSwUbf5t+V/vCFQAuzB1cQGg+D5+6VuZumnyeJNqzyttRtWQzxJb bXbpYb3RhqUd9tWPA2ets7b0kWWq2rte5GDU3tL/NTVEeHPQfgslI3M7I1amNKhRgBcb g0RYjZgU6l6qcU1COdqa58rDFRf2IYaZ9j3dDEN+By6FBD84DwaMXiMRgArB+hbdLDjP ot5pXwlR/G+b1X9hZzSz7MipZELPGHgv0ALqHb6mKStIi2EiYsufx+axmTF+MVoVXMhC s+4lEO5dhfR8fQ4WUsa3BQ2qulkwaV0iqXPZYfhuERZg1WvovJRDt+vXHkZayKmBlVId yu2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=DY7j7x2w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id v2-20020a655c42000000b005b96af23fe6si7503360pgr.284.2023.12.04.05.13.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 05:13:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=DY7j7x2w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 01477805649A; Mon, 4 Dec 2023 05:13:15 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233570AbjLDNM5 (ORCPT + 99 others); Mon, 4 Dec 2023 08:12:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235352AbjLDNKb (ORCPT ); Mon, 4 Dec 2023 08:10:31 -0500 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83456184 for ; Mon, 4 Dec 2023 05:10:24 -0800 (PST) Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1cfb4d28c43so14942555ad.1 for ; Mon, 04 Dec 2023 05:10:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701695424; x=1702300224; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=YEZs6AO2flglBsYRf33FcA1+MeCcJm84o+twFj/3LKE=; b=DY7j7x2wlkXaD4UalshzkAjBhVEhd98Rf5MEmY88XUtZCwFsvP9lh3TU9v81uDNDwZ xAVJIT8OR15vRS79EeYaT1YajIRAOAsZtRGntiUl5Pbw/z1Wo3ZzbLR0jVHfjMbQ/PHr qGMVwhba8Pb/dRagIgxWPoLzo1UCqbdtekrTDvvrJMJ+or2N6YB9NYMsjXQaEXx8pqOx 92ixK4Z7lHUqUwnBFRP8V1W4sgHHgef+q/SvK0mmuFiyTG5P/87gHy2Uk7WHQE757mdj b/P8QDm43fLcxbhlDVKUaDcMde0p6UFXWZQgFeIw3L1CTNmS65PrcD5pp5hZnUKpE/0g HMkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701695424; x=1702300224; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YEZs6AO2flglBsYRf33FcA1+MeCcJm84o+twFj/3LKE=; b=p3ZQ35dbMDx/IVnUJVxtgdrcEMnUal9Zs2Oi+7nMX6NmlAMFeQSH7bZ+0xktKfVjCc xq6kMKH3Heuqy9lVPDnP/Kyl6pZ/3n9rGRsCPsw10RWdwQlykiH9rl1CYrqCvJ4lwsO0 nxCNIQB/8GM7vUB/QT89olF82waUx6FU4jkaiOZr3mAt+a4RYsALBJgovtN/kc1q69rf RPWGyBpUcNFn6U+4ALN/kG07UbqcqPHXhZmi+t+vcNiwXaLuqjmFoKYJKRxeUWUW9rud COz+i0AszWMkyPpHNitUiZwUlW4pMYLXOtubAiUvT2dBKOKif0XmvDlQzZc7qvIggzw9 phtw== X-Gm-Message-State: AOJu0YwKQ5yAuQ1TzCOT1R4Ynyd/jBxA/pGAx60U4l3bwa0tMJtJhsfa iPohCka3P4gW4MaEMbd+FkMN8MaazRY= X-Received: by 2002:a17:903:191:b0:1d0:727b:251d with SMTP id z17-20020a170903019100b001d0727b251dmr1325812plg.137.1701695423710; Mon, 04 Dec 2023 05:10:23 -0800 (PST) Received: from toolbox.. ([2401:4900:1f3e:53bf:50c7:2988:e019:4b97]) by smtp.gmail.com with ESMTPSA id e5-20020a170902744500b001d049ef0c1fsm6699156plt.190.2023.12.04.05.10.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 05:10:23 -0800 (PST) From: Ayush Singh To: greybus-dev@lists.linaro.org Cc: Ayush Singh , johan@kernel.org, elder@kernel.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, jkridner@beagleboard.org, kernel test robot Subject: [PATCH V3] greybus: gb-beagleplay: Ensure le for values in transport Date: Mon, 4 Dec 2023 18:40:06 +0530 Message-ID: <20231204131008.384583-1-ayushdevel1325@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 04 Dec 2023 05:13:15 -0800 (PST) Ensure that the following values are little-endian: - header->pad (which is used for cport_id) - header->size Fixes: ec558bbfea67 ("greybus: Add BeaglePlay Linux Driver") Reported-by: kernel test robot Closes: https://lore.kernel.org/r/202311072329.Xogj7hGW-lkp@intel.com/ Signed-off-by: Ayush Singh --- V3: - Fix endiness while sending. V2: https://lists.linaro.org/archives/list/greybus-dev@lists.linaro.org/thread/L53UN5ROSG4M6OE7CU5Y3L5F44T6ZPCC/ - Ensure endianess for header->pad V1: https://lists.linaro.org/archives/list/greybus-dev@lists.linaro.org/message/K7UJ6PEAWBLNDMHLT2IO6OP5LQISHRUO/ drivers/greybus/gb-beagleplay.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/greybus/gb-beagleplay.c b/drivers/greybus/gb-beagleplay.c index 43318c1993ba..8b21c3e1e612 100644 --- a/drivers/greybus/gb-beagleplay.c +++ b/drivers/greybus/gb-beagleplay.c @@ -93,9 +93,9 @@ static void hdlc_rx_greybus_frame(struct gb_beagleplay *bg, u8 *buf, u16 len) memcpy(&cport_id, hdr->pad, sizeof(cport_id)); dev_dbg(&bg->sd->dev, "Greybus Operation %u type %X cport %u status %u received", - hdr->operation_id, hdr->type, cport_id, hdr->result); + hdr->operation_id, hdr->type, le16_to_cpu(cport_id), hdr->result); - greybus_data_rcvd(bg->gb_hd, cport_id, buf, len); + greybus_data_rcvd(bg->gb_hd, le16_to_cpu(cport_id), buf, len); } static void hdlc_rx_dbg_frame(const struct gb_beagleplay *bg, const char *buf, u16 len) @@ -340,14 +340,15 @@ static int gb_message_send(struct gb_host_device *hd, u16 cport, struct gb_messa { struct gb_beagleplay *bg = dev_get_drvdata(&hd->dev); struct hdlc_payload payloads[2]; + __le16 cport_id = cpu_to_le16(cport); dev_dbg(&hd->dev, "Sending greybus message with Operation %u, Type: %X on Cport %u", msg->header->operation_id, msg->header->type, cport); - if (msg->header->size > RX_HDLC_PAYLOAD) + if (le16_to_cpu(msg->header->size) > RX_HDLC_PAYLOAD) return dev_err_probe(&hd->dev, -E2BIG, "Greybus message too big"); - memcpy(msg->header->pad, &cport, sizeof(cport)); + memcpy(msg->header->pad, &cport_id, sizeof(cport_id)); payloads[0].buf = msg->header; payloads[0].len = sizeof(*msg->header); -- 2.43.0