From patchwork Mon Dec 4 13:10:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ayush Singh X-Patchwork-Id: 173299 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp2751836vqy; Mon, 4 Dec 2023 05:13:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IEWkcamNUb3TUSVqy8UbSOm8PGz7uoPqaOlVRi1Og1yueR7UnRBaaTt/MyoJ4y+6a1VHtMm X-Received: by 2002:a05:6a00:150b:b0:6ce:477b:5c06 with SMTP id q11-20020a056a00150b00b006ce477b5c06mr1187646pfu.58.1701695596316; Mon, 04 Dec 2023 05:13:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701695596; cv=none; d=google.com; s=arc-20160816; b=ahp4vkwMi7k6JTDOcjBzSQ0MltY2btamZpti58zVBfiWoq/ISdjZ4sPKZ767s4z6zc SB1JlSuo7M306xLs7UwDggRpI3Tkapfpb8RSwE3s6D3FxntOSvoNgeopSd7hB8yDqM6a 8okoXRGHWHecYrdQDAWN3ZO6Qucq4P0T/E1Aydo3MNNa0N8pQYDx0Ed7NXhnxCFVN9/F x7qmEhqhITAalMS95OdfOuvzmeLhJ5kWjEBolpwNDKV0UIXkcIz+1HC9Uose69zrGMvF N4JVjFGJGlsXOkOBoyzHXXB/N2xcyxyc+dyaCafU3ScksfVYluxDH+Z4BNX4ivjjtHPI 3q1Q== 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 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id g21-20020a056a0023d500b006cbb2cd545esi7931538pfc.5.2023.12.04.05.13.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 05:13:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; 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 23.128.96.37 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 4A2FB80564B6; Mon, 4 Dec 2023 05:13:14 -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 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:14 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784357161310617968 X-GMAIL-MSGID: 1784357161310617968 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);