Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp3068094rdb; Mon, 4 Dec 2023 16:14:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IFB3N0rb+wAH2QYQOPjl+9AhDuMe9QVlb5tb9DyK2c2CwLkRiYJfUl20HlRtmXfvApU67My X-Received: by 2002:a17:903:1c6:b0:1d0:9013:a139 with SMTP id e6-20020a17090301c600b001d09013a139mr1754772plh.43.1701735272738; Mon, 04 Dec 2023 16:14:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701735272; cv=none; d=google.com; s=arc-20160816; b=worE5bXTdscoamf/xsOE01Cux/G6I1/hZwxa/A/SdaZbCs2LjRMl9mSeYeabuQ6gYO 3PT5aJVDbhPcxkrF73rTBNVfSPTmb1qNKl4uROBF+OT3xMGVTlg5gi4rGqF3+y1yD0Rf t/HCVgDL+omlygKv7crZljHES459uvV8kYgeACW5C42Ib36DMBSG+8y75DLNWTO6/QIL TPkUA4MB7ohT4ZD2Iy5v0xLnOpW3FPMxUDm3rQp1XHV1iNPNQB8iz6r3qb3Ly7qutfzk dMDJzAb5CQvwehlO724Fo/LB8SdSvEjP68S+MjEfKLXjMXMgxFhNP/UlNMW3AUKardAu vQew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=vp50tvWQjTbyKv9H8SThT/CQC7/3wUJsz5xSXCTV1hs=; fh=F6vrVq0gA9HfYgZYmVgqLgKaOiLBASMopFfTB7i9Kts=; b=onGMJ7UvfD1r8AFUYODnoBzpyJheOk1+f1YtOZaAiNxlaYov7KZekhRxuWtBz1GPIG 43s4k/tkRsc9kYklu/u/2qp2sqdA0CR7JIKBolSVSgBqGKsPiruh/vemI/bqC/F8zbtx SxcUY0ErU4U7FXu9DodufUZ/uVFxkli+2OnFk39iDi0fxNTX0+0FpvgJ86DgywJtPxYE cutE/Gm9nJATFKvbDYfd31ylI81GCSblCO0VJeZAVMR6huAYM94NWhb7A6j8dHibgexQ JJy0JuMebrwPfL4uH6P1teXEmiq8XO5HDy+cPjtzAOBYaanS5DQkmDmCN+8t9xDcPV+q HfUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sDzOv3n3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id l16-20020a170903245000b001d044978d7esi2624613pls.598.2023.12.04.16.14.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 16:14:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sDzOv3n3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 317D88043AD8; Mon, 4 Dec 2023 16:14:30 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229668AbjLEAON (ORCPT + 99 others); Mon, 4 Dec 2023 19:14:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229847AbjLEAOL (ORCPT ); Mon, 4 Dec 2023 19:14:11 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A81E120 for ; Mon, 4 Dec 2023 16:14:17 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0EC5C433C8; Tue, 5 Dec 2023 00:14:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1701735256; bh=fUrk4RiGbZxusBO78Ffl1INnFFomDcxaJChxDkyTxsk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sDzOv3n3qO2RWlXnBgEoNPZsMxpFJYweRElhiGiR1Pe7EBY8SF3GF/XQX60KZpHBy yylKnunnvUteLRqUe/7YRhSW3/g437KDhnDn3Gc68uOpo/a1zAPoeg/z5HKZjnYn+t MoPmGVB9A5409whVcoDoFIVc9fJqP2jCfDHRX7v0= Date: Tue, 5 Dec 2023 09:14:12 +0900 From: Greg KH To: Ayush Singh Cc: Johan Hovold , greybus-dev@lists.linaro.org, elder@kernel.org, linux-kernel@vger.kernel.org, jkridner@beagleboard.org, kernel test robot Subject: Re: [PATCH V3] greybus: gb-beagleplay: Ensure le for values in transport Message-ID: <2023120515-mongrel-undertook-6e5a@gregkh> References: <20231204131008.384583-1-ayushdevel1325@gmail.com> <7ead544b-9234-483f-aacb-55ed05b01fa3@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7ead544b-9234-483f-aacb-55ed05b01fa3@gmail.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 morse.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 (morse.vger.email [0.0.0.0]); Mon, 04 Dec 2023 16:14:30 -0800 (PST) On Mon, Dec 04, 2023 at 09:58:55PM +0530, Ayush Singh wrote: > > On 12/4/23 19:42, Johan Hovold wrote: > > On Mon, Dec 04, 2023 at 06:40:06PM +0530, Ayush Singh wrote: > > > 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); > > This looks broken; a quick against mainline (and linux-next) check shows > > cport_id to be u16. > > > > I think you want get_unaligned_le16() or something instead of that > > memcpy() above. > Thanks, will do. > > > > But that just begs the question: why has this driver repurposed the pad > > bytes like this? The header still says that these shall be set to zero. > > So, the reason is multiplexing. The original gbridge setup used to do this, > so I followed it when I moved gbridge to the coprocessor (during GSoC). > > Using the padding for storing cport information allows not having to wrap > the message in some other format at the two transport layers (UART and TCP > sockets) beagle connect is using.This also seems better than trying to do > something bespoke, especially since the padding bytes are not being used for > anything else. > > The initial spec was for project Ara (modular smartphone), so the current > use for IoT is significantly different from the initial goals of the > protocol. Maybe a future version of the spec can be more focused on IoT, but > that will probably only happen once it has proven somewhat useful in this > space. Please don't violate the spec today this way, I missed that previously, that's not ok. We can change the spec for new things if you need it, but to not follow it, and still say it is "greybus" isn't going to work and will cause problems in the long-run. Should I just disable the driver for now until this is fixed up? thanks, greg k-h