Message ID | 20231114140103.784484-1-ayushdevel1325@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1878289vqg; Tue, 14 Nov 2023 06:02:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IFdYVw3IuHaIdxNrqJnqkkVi9uIZlG8AEZ4+VgCGbmItx9CLPxvxg1i8PkGrlgVTRYrGL80 X-Received: by 2002:a05:6e02:1a87:b0:35a:d052:da48 with SMTP id k7-20020a056e021a8700b0035ad052da48mr823858ilv.29.1699970543060; Tue, 14 Nov 2023 06:02:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699970543; cv=none; d=google.com; s=arc-20160816; b=ZNuAAt2hJfSVo8H65Cf9x8PVm9albprwWDKALWrg3K2bDXMqetrZWHH9IQGNWwD4wy g51WBqMT1dIVZYvVYbCp+l5hl41Fv7MMBnd52hlO/pR9+uZSKXx0DFdO6gbDMwEDTM48 oq9RdbGx5Lzxt+DG4WVNwYVsECjCkL3idSyUyd7ynKUd9s7L8y/VkT1vetbK+Rbvs79K 1b2GDRo9VdB7LryMhSM/KRhO1ahqujYHqIhDCXYs6I6IQC9JohIQSsxw8odajjfjcpOO xG5TkizvvQP+18dACuHerjnFiHBjpDhwgurZOHOEUUwWWeutn0ndmSvK19Xul7LlGeIf vX/Q== 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=LPaXAqYY/yDcBKqyxlX4UqgDs4pXQVFVUpt4WE1cEdQ=; fh=rtycjj/ET+2VzuL+RJFM1b2so/d6VMD+FuOM1vq30y4=; b=cjL7w2yGvDWJYoDwkTgQ4spyv+SDesks8ZDQiNkPNMrioteAsR4QGxoUpxt4a5gSv5 aWC+uPMWvoU7t8Z29Nbla7/B08iYtWkFW1sWbAqVLGSTUHte0SmQVuKzUF9vr4WE2thb N9lGX+s0EkdnhytBpAFC/q9SsSdKz/JPB2hIuNWvWvf8rs/C0qzbB8xAntdV9pZimOCk sbfTFcNohqqHylZA62ONWYp89BKZhf0lEJBYKjRTc/lUZ2WAdZVzAxvtZCMcytEeAJ22 6UvNPyPfNa87q9QjpEx+ls8R54dn6xci/8zHIgSP3JR79fdDL/8lh0OBvE3ioRk//0z5 m3xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="K11E/GwM"; 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id k6-20020a056e021a8600b00352832ac0bfsi3060783ilv.145.2023.11.14.06.02.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 06:02:23 -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="K11E/GwM"; 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 515878066652; Tue, 14 Nov 2023 06:01:26 -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 S232168AbjKNOBW (ORCPT <rfc822;lhua1029@gmail.com> + 29 others); Tue, 14 Nov 2023 09:01:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229697AbjKNOBU (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 14 Nov 2023 09:01:20 -0500 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F308130 for <linux-kernel@vger.kernel.org>; Tue, 14 Nov 2023 06:01:17 -0800 (PST) Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1cc330e8f58so41351785ad.3 for <linux-kernel@vger.kernel.org>; Tue, 14 Nov 2023 06:01:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699970477; x=1700575277; 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=LPaXAqYY/yDcBKqyxlX4UqgDs4pXQVFVUpt4WE1cEdQ=; b=K11E/GwMXoc24xNBsB4XGIMr3g69OLdSq2HuBtEuWLi8v8/8s46cG2nRoq3sYkjrVJ 1blRpMsgnRqx222SHNbxj0HG2gyJ7IC1qMrvCa2U8ZPMge7YSbKnZbnekk/vFqz38FlI mWT0PKJ3z3IZdGs0IYLl5vvTWoyXvJnD3g4+s3ACRMJraksMSvBdgHba22kVPgT535jT b8bn3y9syu+keRnjbis7SmVI5PDoBkXB5gZgqmo6rzVcymaURgVfMrM/hZow30o4ZgwG 6dTU7u6OZMCt/l+Ik4bytB3Z9UD7TyfPgYWA8Ygj4lz3retGvLX5vmAxt5q/wLIevjJe Rqjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699970477; x=1700575277; 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=LPaXAqYY/yDcBKqyxlX4UqgDs4pXQVFVUpt4WE1cEdQ=; b=LCu4Gm7Ed62CZASGtLerLMgxugMmVkNbEimE6YMNH/YWOQr0u5Jwxlh4L/5JrebS5G x++24G9YO7wMWWzu7wbQ3Cn+iVDt4eytQyJ537W6Fhokt5UZauZmuYDIXeHA7W896YJ+ 08skLpfzxW+d5x74jwUBWAw6qR6aWJVAMITRawE5NhZjkC9K9EpOQ7UEuI1vTzr6GcQH GPbSSvMDeTMDRjx0rrXgVI08unhmGB+h/vAthcWgx0FytBku7VYGWmUzvGW8CQx9tfnU aGbUY/2Rr4AfDdO39mHd+c4muu8psbySv6AUsqS8vwojkA4sc4pJnUvBzuTocc10CF/3 Mzeg== X-Gm-Message-State: AOJu0YwB1jgAntC5TXCBpy+EP7tkgwmPPVyMN9LyiwKJAdaUjImia/F3 l/om90otlPD9X2I5k8+M7I8= X-Received: by 2002:a17:902:ce0f:b0:1cc:7a8e:606b with SMTP id k15-20020a170902ce0f00b001cc7a8e606bmr3017314plg.43.1699970476774; Tue, 14 Nov 2023 06:01:16 -0800 (PST) Received: from toolbox.iitism.net ([103.15.228.94]) by smtp.gmail.com with ESMTPSA id c5-20020a170902c1c500b001cc31dcec49sm5654521plc.146.2023.11.14.06.01.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 06:01:15 -0800 (PST) From: Ayush Singh <ayushdevel1325@gmail.com> To: greybus-dev@lists.linaro.org Cc: Ayush Singh <ayushdevel1325@gmail.com>, johan@kernel.org, elder@kernel.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, kernel test robot <yujie.liu@intel.com> Subject: [PATCH] greybus: gb-beagleplay: fix restricted __le16 degrades to integer warning Date: Tue, 14 Nov 2023 19:31:02 +0530 Message-ID: <20231114140103.784484-1-ayushdevel1325@gmail.com> X-Mailer: git-send-email 2.41.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_NONE,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: <linux-kernel.vger.kernel.org> 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]); Tue, 14 Nov 2023 06:01:26 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782548312160513566 X-GMAIL-MSGID: 1782548312160513566 |
Series |
greybus: gb-beagleplay: fix restricted __le16 degrades to integer warning
|
|
Commit Message
Ayush Singh
Nov. 14, 2023, 2:01 p.m. UTC
greybus message header->size are of type __le16, so to fix this warnings
we are using le16_to_cpu() macros.
Reported-by: kernel test robot <yujie.liu@intel.com>
Closes: https://lore.kernel.org/r/202311072329.Xogj7hGW-lkp@intel.com/
Signed-off-by: Ayush Singh <ayushdevel1325@gmail.com>
---
drivers/greybus/gb-beagleplay.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 11/14/23 8:01 AM, Ayush Singh wrote: > greybus message header->size are of type __le16, so to fix this warnings > we are using le16_to_cpu() macros. This is more than a warning, it's a bug (though it has no effect with a little-endian native CPU). I suggest you add: Fixes: ec558bbfea671 ("greybus: Add BeaglePlay Linux Driver") Should your hdlc_payload->len field be defined as little-endian? I've only scanned through this file at this point but I'm thinking there might be other endianness fixes needed as well. -Alex > > Reported-by: kernel test robot <yujie.liu@intel.com> > Closes: https://lore.kernel.org/r/202311072329.Xogj7hGW-lkp@intel.com/ > Signed-off-by: Ayush Singh <ayushdevel1325@gmail.com> > --- > drivers/greybus/gb-beagleplay.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/greybus/gb-beagleplay.c b/drivers/greybus/gb-beagleplay.c > index 43318c1993ba..b3f47b5cbbfa 100644 > --- a/drivers/greybus/gb-beagleplay.c > +++ b/drivers/greybus/gb-beagleplay.c > @@ -344,7 +344,7 @@ static int gb_message_send(struct gb_host_device *hd, u16 cport, struct gb_messa > 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));
I apologize for the late response (college exams were going on). I will go through the driver to find if any other endianness fixes are needed. As for `hdlc_payload->len`, the whole `hdlc_payload` is an abstraction to store array length with the actual pointer. The len is never actually sent over HDLC, so it should be fine. Ayush Singh On 11/14/23 20:27, Alex Elder wrote: > On 11/14/23 8:01 AM, Ayush Singh wrote: >> greybus message header->size are of type __le16, so to fix this warnings >> we are using le16_to_cpu() macros. > > This is more than a warning, it's a bug (though it has no > effect with a little-endian native CPU). > > I suggest you add: > > Fixes: ec558bbfea671 ("greybus: Add BeaglePlay Linux Driver") > > Should your hdlc_payload->len field be defined as little-endian? > I've only scanned through this file at this point but I'm thinking > there might be other endianness fixes needed as well. > > -Alex > > > >> >> Reported-by: kernel test robot <yujie.liu@intel.com> >> Closes: https://lore.kernel.org/r/202311072329.Xogj7hGW-lkp@intel.com/ >> Signed-off-by: Ayush Singh <ayushdevel1325@gmail.com> >> --- >> drivers/greybus/gb-beagleplay.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/greybus/gb-beagleplay.c >> b/drivers/greybus/gb-beagleplay.c >> index 43318c1993ba..b3f47b5cbbfa 100644 >> --- a/drivers/greybus/gb-beagleplay.c >> +++ b/drivers/greybus/gb-beagleplay.c >> @@ -344,7 +344,7 @@ static int gb_message_send(struct gb_host_device >> *hd, u16 cport, struct gb_messa >> 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)); >
diff --git a/drivers/greybus/gb-beagleplay.c b/drivers/greybus/gb-beagleplay.c index 43318c1993ba..b3f47b5cbbfa 100644 --- a/drivers/greybus/gb-beagleplay.c +++ b/drivers/greybus/gb-beagleplay.c @@ -344,7 +344,7 @@ static int gb_message_send(struct gb_host_device *hd, u16 cport, struct gb_messa 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));