From patchwork Sun Dec 3 07:53:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ayush Singh X-Patchwork-Id: 172915 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp2127454vqy; Sun, 3 Dec 2023 00:04:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IFF7XBI9smecLvatpW5ifen/c3A6CmkTSzrz4kSnuAm0BrHfCZfkrADBy9F7jzNj/udSaT0 X-Received: by 2002:a17:90a:9501:b0:286:54d2:5767 with SMTP id t1-20020a17090a950100b0028654d25767mr2386414pjo.0.1701590642591; Sun, 03 Dec 2023 00:04:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701590642; cv=none; d=google.com; s=arc-20160816; b=r1+GxaiAueY+XwHsJ7fnJBiSYEdiXEwaOQ7Iyho7vdgYCl+nfMWHMmAPt0E5cqSQ1S PcSQ8yZdq8Fb8Y5GIXdOy50rKFuOn64gylg8vehDNF/BAHfVnBTbGrDYXDqsxuwrLwiq nHZnSqKvg/vOKCdxp90TMYPsQjyjB6bkgUEOWWgQmio4INSLZ52hzEMPadOqlXZCGzq9 OPsmddgoJA6GMyZ8+/rf+2il7TgPd/k3E9+ctBarzwLaeVBk2X4+mcHhTnvDUezdhCVe 3mlHpQR3Rgar3+L7a598W/7kUfHVBT7MJjSgY1mWJG40GFcix5ogSJCSm7BH2DMQQ3B5 fzaQ== 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=A333Tym+pDimr9g/5OsWQd95HIDuYjW7G190dYNC2Ek=; fh=3/TDM0VKyeEwR/D51+Id+IFBXV+CnuDpYD6ip4jz1wE=; b=iK5AxuzlzjHWMtR3vWIk8tM3Mto9sWRExawjFdwjkSLIYuzm0pnZtXA5ntOfgU9ahc Gh3RYTqOrH9Hm5sPQQLiDZSHE59qXE0igkRniczo2Kcdzn9NeccdLF8GQRyDsq2+vwC4 GXFn+8FXfzXSUM9aUIqAqfknnqqFeHoeQGKHM0GlyhCq0YjUVdECIXTn3szCPSgJhr+f ozQXwSFf2yRvMaxYqkX1eyEurAO4S13mvdeddQijL94vfqL9XQwV5j5C7L7h/I362SPG fvOg7tPosRtAVw8Xo1edxi6WL8pfpt/xL6st2wgHshZnIxexgPEewf0fbco6sdUz0a1c kNCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=KxDyVxob; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id oc12-20020a17090b1c0c00b002850e97e25esi881178pjb.2.2023.12.03.00.04.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 00:04:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=KxDyVxob; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id DFF3C8087DDC; Sun, 3 Dec 2023 00:03:58 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232892AbjLCHxZ (ORCPT + 99 others); Sun, 3 Dec 2023 02:53:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbjLCHxX (ORCPT ); Sun, 3 Dec 2023 02:53:23 -0500 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE8BD125 for ; Sat, 2 Dec 2023 23:53:28 -0800 (PST) Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-5c66988c2eeso451386a12.1 for ; Sat, 02 Dec 2023 23:53:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701590008; x=1702194808; 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=A333Tym+pDimr9g/5OsWQd95HIDuYjW7G190dYNC2Ek=; b=KxDyVxoboefOxuSxAYiIDyltHrH5ASB00L9n3FUaxO0w2UmfZ7/PJX8M7gN7fnH9sA UwVN9ZeE4qy0yqvX+7KU03rXbxo4VBnJs64qSzf3b4DE21c2L/A55hMsQcabft7J0yEX 4ERprTFr2PFYZr8cy1CKlAigywawgCV3KGsDRnxErHdMxMWC/cJqF7Fnfkp9LPFwqVwM 5WXVD1jDrmPiVKfdQdTV7mcOS3XSENKbUU11vOStr3Pq8rwr/L6vvubgJGtjYMLxu5OG qUGRT8mO5IVtUREaxJO/PccbjoJ+yht5mm6Xq2RHBEKzxbSoGxfKarhqpHtptq6Z0V7K HqJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701590008; x=1702194808; 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=A333Tym+pDimr9g/5OsWQd95HIDuYjW7G190dYNC2Ek=; b=bFTXr8O1MCyW9CFX3wVRvIvJTL6OSEPfeGBHTkKjoYSv2SSZITKPg5tvnAK54eDTVT lU7DdGrk0Rn+tqKlynDBuPL+z41vyeNV2j8c48OefGTkMfGxL6UtwC/cnwSRar7ERq69 SQZ1+7s/q2r8DnwZ9GT0PuR9cW7z+QHuCrT3pJXfu75+3HwDKFyYjn5mpY+h40qG1SxN xU3w3gHhbjm9G0ExO7UNuGp68+djU0Erm5W4HQQRd0kL35oHmb37uU2cISV+co0c31MR AoM20QdKPPNgSmCJjr7/7DDg6k5J5kDiuI3ENtos1zHrIc+nR9wEUW2BylDtWEFIIVdT kERQ== X-Gm-Message-State: AOJu0YxL7Wqv3bEUT8XYZzr6D8B/ijU2fgdv3PvFICOn/3fUJR/RZq+S ZA9m9wmT+DOeTUWfueuRAWBEK33iezE= X-Received: by 2002:a05:6a20:8427:b0:18a:e4ed:cc41 with SMTP id c39-20020a056a20842700b0018ae4edcc41mr2910284pzd.23.1701590008172; Sat, 02 Dec 2023 23:53:28 -0800 (PST) Received: from toolbox.. ([2401:4900:1f3e:53bf:50c7:2988:e019:4b97]) by smtp.gmail.com with ESMTPSA id e15-20020aa78c4f000000b006ce4c7ba448sm280491pfd.25.2023.12.02.23.53.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Dec 2023 23:53:27 -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 V2] greybus: gb-beagleplay: Ensure le for values in transport Date: Sun, 3 Dec 2023 13:23:10 +0530 Message-ID: <20231203075312.255233-1-ayushdevel1325@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Sun, 03 Dec 2023 00:03:59 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784247109212345054 X-GMAIL-MSGID: 1784247109212345054 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 --- V2: - 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..1e70ff7e3da4 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 = le16_to_cpu(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);