Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp449008pxb; Sat, 21 Aug 2021 07:20:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0GfjEGaIvOOVMl8XpYy1OR9KE7Fdn6BP1NEK5XJvd4Jh5KS4KCCLnV3Ucikz/D+4glA4H X-Received: by 2002:aa7:d147:: with SMTP id r7mr27761095edo.148.1629555658727; Sat, 21 Aug 2021 07:20:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629555658; cv=none; d=google.com; s=arc-20160816; b=HxGa4urLE5IQyAhSbzrztXB+PlbYLHXdD6MRZS/OOroOeBOATF6XkBR3IJ3MVLJjHK moDC1awZ4bNJ+s44D5d16U67nTiVAPpU5PKVVW1hAUzydW9V6bw2qlERojTPXn+289n1 erx7d9lWaGG+d4nUyY5CX57mlsTCnF1HTfmTTyaUEK5JtwBzPXhWnhSs2oMzMxrnSXZp phRrcl6DYRAezhr2KEHfo5GoLO+Fh3QFOdLSnuHAA74I6c6gVTpmbWTfNcbZbyFMrNXL fJOm06RuoQHMOHbQIE4SQAy9xkXztfCX+qpdXwHiaMF8HReBnI4Te6gb6GG2dKQjh1u0 BJ3Q== 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=jehk/SAV88QAcVymj6qobcNZQrFrGYFZzagP5r8Z4ns=; b=unrkc/2gZ1LjomH/dDkE/xxON3AJkGPNuc7yAyVzxojLYzvrSFWukEG6HY5jF3t0A6 0kK/WZAxcuKrt97mlMXXz7t+2cernLjsM7AQTJviDt/EePKI40oCSMgdOWgoApfSB+ui 7tfwVa7o0nCMNGqYuejnuPWyNzDaN/ACYgmQNR1VW+6pMMjqOwA5W1pr73QDYFdmy8KB Tv2TgGGNb/0un1NmYcnRKeodRNforv18G95X74JfcnwTYA5H6K7egXdUeLCqdhruLlr2 XnL6JisPaOLGNmh61i5atJJaxBBzcPf9m136mptg1Z5bgTlR9Vzca42gjYE0vhqbVXJh DFSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XaAaRGcV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v10si10286251ejy.710.2021.08.21.07.20.34; Sat, 21 Aug 2021 07:20:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XaAaRGcV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230233AbhHUOT3 (ORCPT + 99 others); Sat, 21 Aug 2021 10:19:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229714AbhHUOT2 (ORCPT ); Sat, 21 Aug 2021 10:19:28 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42F56C061575 for ; Sat, 21 Aug 2021 07:18:49 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id j10-20020a17090a94ca00b00181f17b7ef7so2902717pjw.2 for ; Sat, 21 Aug 2021 07:18:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=jehk/SAV88QAcVymj6qobcNZQrFrGYFZzagP5r8Z4ns=; b=XaAaRGcVxjGBSRqOemxoFACYeDiCmZN3SZvnOemXvEmg9sQ5VQWlhMF27tCLPIJTZZ +OAFXQfeNPQ7Ysb5FBSHxyDssrxhUkaWMN+w/Sx7j/g27foaednkAWtSVAuob28/FN+u HZBGrOe/ibyB011Mgbf3kdwMPSV8aD0GgTUJKPEo1vGFRr4tES3L7aCpDaF/G69HoCHn T4hB4iWFii2/WFX+qZD5TLM4f8oVopRRvJHbAA+/e0LpE/4Fk4UnUcfqjL8Yc2Qp2Jim tLBEzUiia6SoMexqThhOKHlWMJfULJGSCFHKL4+0lOJW3YBgxBUpLCYzw5BDy+F5wF4/ MFNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=jehk/SAV88QAcVymj6qobcNZQrFrGYFZzagP5r8Z4ns=; b=neW1abO8d9Pf5Sv3evwI56TJNuXmxqj184D6CTaacBrytgoR4CAzeqtax2rRs5LKrP 01mvgxQWuLJ3xjRUnxdagjwgrrjFbDdkXm8IjnpQ+l7ArLCqzvSjqGF0aKn0fG6Tnz3u FkJ9roSmOX7qFK7Y5oUx5fZLVGehMWzcQP/6nd2of7sb9uTzDimrOIz2EohX4wZvxjER 2l5cnZxbR/CdSaQNYfrdDtXfJphzVruO1gi8jG02HEK/jJev/vijwk5lCKJL3gif5wKT 81+S0G7rCITHpWr7NBJFJafbNsTG/TdFSG8zf4rWyZZXkhxTXSdXJ4YUxPy63EpZLB8e Ez1A== X-Gm-Message-State: AOAM533CQeI2cNc/D9kvFKzEjNecYUW1I/RUPX8SguR76qnjkipNoM5R 3tXux18Xm1F28c3UDqj5J1ZvV4/3DMaR+iKV X-Received: by 2002:a17:902:ab53:b029:12c:57a6:13ae with SMTP id ij19-20020a170902ab53b029012c57a613aemr20741714plb.53.1629555528697; Sat, 21 Aug 2021 07:18:48 -0700 (PDT) Received: from localhost ([49.207.137.16]) by smtp.gmail.com with ESMTPSA id j11sm10816718pfa.10.2021.08.21.07.18.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 07:18:48 -0700 (PDT) Date: Sat, 21 Aug 2021 19:48:46 +0530 From: Aakash Hemadri To: "Fabio M. De Francesco" Cc: Greg Kroah-Hartman , Larry Finger , Phillip Potter , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 4/5] staging: r8188eu: restricted __be16 degrades to int Message-ID: <20210821141846.k4n4eorn4ifk5lfj@xps.yggdrasil> References: <1777630.LqDDHREl4S@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1777630.LqDDHREl4S@localhost.localdomain> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21/08/20 05:10PM, Fabio M. De Francesco wrote: > Building on the objections you had from Greg I suggest that, before attempting > anew to address problems like these, you get a better understanding of the topics of > native and network endianness and of the API that (conditionally) swap bytes > in a variable between little endian and big endian representation. > > To start with, please note that the following code leads to tests for "v.vub[0] == 0xDD" > which is true on little endian architectures while "v.vub[0] == 0xAA" is true on big > endian ones... > > union { > u32 vud; > u8 vub[4]; > } v; > > v.vud = 0xAABBCCDD; > > Also note that API like cpu_to_be32(), htonl(), be32_to_cpu(), ntohl, and the likes are > used to (conditionally) swap bytes (i.e., change the arrangement of the bytes in a > multi-bytes variable). > > Casts have very different purposes and usage patterns and, above all, they cannot > magically change the endianness of a variable. > > Regards, > > Fabio > Thanks for the explanation Fabio! Will rework and send it through! Thanks, Aakash Hemadri