Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2139376pxb; Thu, 11 Feb 2021 05:31:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJzR1QAubC01Xqi+Xf1SPCHkd8oQc07fAQLSjGTjl5M3fEBeil428Hr3k/hsUGQiTOzYjhZx X-Received: by 2002:a05:6402:2683:: with SMTP id w3mr8335818edd.378.1613050299450; Thu, 11 Feb 2021 05:31:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613050299; cv=none; d=google.com; s=arc-20160816; b=aP7xmYzJp59Tpr7mhYAguPmQ4jZv/cEuMaFvtY2z1PwKCDpNmeTdH9XIQ6YTMEzw6H /t144/xMsknsUfVQLumHJviqS7+UwNx1Ue451h/1uQ1/ViyMLzEVJddxSKcnCC5gC4Vf VVkjpyIOFnnis8hIV7zJXtAT+yPDGpF9mW89jrZao7vIbbCTyaK9BqzK2fd7vpuVaXzl /pg4yyGCNxN9QFFV2YfnFv5kNldKNJlYDthEQAzoyfSnSKutfPDgp1UwruhJW/k9w+5S IedtQIzJ4bL1tR13I16O0hPXeM1+0sb1i0l+hCfi5cbc/kDISc7XIjuHyhRU4jRxFsgE brzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=rYnZXX7xVoF/2okXeVIdVLQ4/9mn2jaZW6zjBohbLEA=; b=hPGI7yG0Njlx1tg1b2wfoad2mM8za3nMbGbWwaHP33iufDbvECw157TU8L4az13SZn WWGryeE8Bn4UQokoTsKmZUao9F8d/l3lbS9+vuIiTIHSTUnYxoJEfpyBCpf4AYwEFBMG P6aQQ8MJU2xRxJjRW0NIERPQ3Jed7gaSrIQ+WMQUmC7MlBGRoqC/vv2wr+XOAb+QDy2A IB6V5XWl6TLZwgbsfBkE4AdMqPkkXBL5jksSt1z56dbQgWZGJ3VPrTi9F2mOjuyS36i+ GFhcGOLc8/cTxzZ8hNtZRVSsVF7q6AnVu9w2IZTye5b6b1wjKvZ68uTY6tiV/0P0crv6 BREA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a24si3878959edm.608.2021.02.11.05.31.15; Thu, 11 Feb 2021 05:31:39 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230311AbhBKN3r (ORCPT + 99 others); Thu, 11 Feb 2021 08:29:47 -0500 Received: from mga09.intel.com ([134.134.136.24]:43014 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231624AbhBKNGq (ORCPT ); Thu, 11 Feb 2021 08:06:46 -0500 IronPort-SDR: 55ObIwXXP7Ce+w74u2c3hDjZHO3GcWqkMcBtUfKazDIngzn3bigOULlPiVf33d343Cd0zZqqMH iLmcAyNdWchw== X-IronPort-AV: E=McAfee;i="6000,8403,9891"; a="182369696" X-IronPort-AV: E=Sophos;i="5.81,170,1610438400"; d="scan'208";a="182369696" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Feb 2021 05:04:51 -0800 IronPort-SDR: xmlb9NqFgliArX/nIyV1XOP5dZrVm+iMz+ouoHhFVFin0OJO3ifO98hiQVCt3vuiEQ6czA0zcz eIuL75rTI65g== X-IronPort-AV: E=Sophos;i="5.81,170,1610438400"; d="scan'208";a="437106463" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Feb 2021 05:04:49 -0800 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1lABeJ-004E5z-3c; Thu, 11 Feb 2021 15:04:47 +0200 Date: Thu, 11 Feb 2021 15:04:47 +0200 From: Andy Shevchenko To: Maximilian Luz Cc: Hans de Goede , Mark Gross , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-test-robot Subject: Re: [PATCH] platform/surface: aggregator: Fix access of unaligned value Message-ID: References: <20210210230411.1938660-1-luzmaximilian@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 11, 2021 at 12:58:48PM +0100, Maximilian Luz wrote: > On 2/11/21 11:22 AM, Andy Shevchenko wrote: > > On Thu, Feb 11, 2021 at 12:04:11AM +0100, Maximilian Luz wrote: > > > The raw message frame length is unaligned and explicitly marked as > > > little endian. It should not be accessed without the appropriatte > > > accessor functions. Fix this. ... > > Also it's possible to annotate temporary variable and use it, but it seems not > > worth to do. > > Now that you mention it, we already have the correct frame length in > payload.len. Let me draft up a new patch with that. Good! > > Side question: Do you think the below is correct (& operator)? > > > > sp.len = get_unaligned_le16(&((struct ssh_frame *)sf.ptr)->len); > > > > To me seems like you take an address to len member rather its value. > > That's the point though, no? The signature is > > u16 get_unaligned_le16(const void *p) > > so we do want a pointer to the len member. So I believe that is correct. Indeed. I messed up with le16_to_cpu(). -- With Best Regards, Andy Shevchenko