Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2141044pxb; Thu, 11 Feb 2021 05:34:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJwjWI0Rmdy4zMxFfcZ6Ep1VYXSN+6qAc244sbNBE8ca1hGNtJZ+Ba6Aiao7/afgfoTSMwIa X-Received: by 2002:a17:906:804a:: with SMTP id x10mr8562632ejw.184.1613050448664; Thu, 11 Feb 2021 05:34:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613050448; cv=none; d=google.com; s=arc-20160816; b=Vr8qNBm1H1turUlzJL5eSYcfp8uD31xa2tC/G4cH3+FLk5UxsqMzsPZnFi11uaXreX zvIIZaYciedMWWezyrn3cSnxoCGcv3IYfxILC0wSdDrOwr5L+1kKoNv+0LHTB8kn8Cgy eXW1ymKG68lyfoEH7OJX4YA6yHLUxkIxs2I4V1532H1v81Ic6X8Xe7LoqcUZnJIwuiKg hQzV/MVbYotvrUu6wkQZ3J9bnEnLluYAYizXjzRJ06G8i2WgRq4DVj7ILoFUsWZwOeFw +7pxr+qy6zfU6h1BJw+O8NO5/jDNsdjMgIq0zKG/+TvTuaSy1DPbrHv2demrr1nIdG6w 9iaQ== 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=uNWH6abs/Cfk323+vpipCbiXVcsrLEf7F2nkBXJSZlo=; b=FrHRGLndSV9oFSR7NN4nf0Y1qZBOo7Oj15DPyojWP2SAYGBM7/766HY6xhtVuyJ0CK 2IHB6bJ+HLxe1It1HusvPo4gtb+bwi7++CqAS0vZIGQBK6AZHERpftulZiGT7qArcby/ pTeAN1F6+Ga6k0lNU5ki6HihFuMaG5WaEnDhACXNlUfxAY8GOhRPFjhpwefvG9XwJJe9 +yBJTXLEkPYju+mvnonMCrUgQZbx7RJDXIY34EXwUPyfn3fpPNJN/Ws7xT8TpaGgycMs No1QhxsKglMRfGb5QiB5sVCKYKf2hgZX2JrxX8p6RilMraXDonzYbidGlQwE5p5Mrd8u vTBw== 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 de28si3528783edb.466.2021.02.11.05.33.40; Thu, 11 Feb 2021 05:34:08 -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 S231175AbhBKNcM (ORCPT + 99 others); Thu, 11 Feb 2021 08:32:12 -0500 Received: from mga12.intel.com ([192.55.52.136]:29897 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231567AbhBKNHk (ORCPT ); Thu, 11 Feb 2021 08:07:40 -0500 IronPort-SDR: z1kKqnFwU+kN5dqt3YHaMVjSqF+1JQd4GQvCe4RcIG05asDY6EzesQyFNI0CR7TI14t+V0D1be t6fIWI++92ZA== X-IronPort-AV: E=McAfee;i="6000,8403,9891"; a="161379339" X-IronPort-AV: E=Sophos;i="5.81,170,1610438400"; d="scan'208";a="161379339" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Feb 2021 05:06:13 -0800 IronPort-SDR: Mm5mJyui1VJd1BUeLJpYp2lb0DD7frreI4IRQpQMPENH4YeDra1ltGX/dwJKqVIRLrernDGMXL JWz2iXzsTmRA== X-IronPort-AV: E=Sophos;i="5.81,170,1610438400"; d="scan'208";a="510846864" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Feb 2021 05:06:11 -0800 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1lABfc-004E6i-FI; Thu, 11 Feb 2021 15:06:08 +0200 Date: Thu, 11 Feb 2021 15:06:08 +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 v2] platform/surface: aggregator: Fix access of unaligned value Message-ID: References: <20210211124149.2439007-1-luzmaximilian@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210211124149.2439007-1-luzmaximilian@gmail.com> 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 01:41:49PM +0100, Maximilian Luz wrote: > The raw message frame length is unaligned and explicitly marked as > little endian. It should not be accessed without the appropriate > accessor functions. Fix this. > > Note that payload.len already contains the correct length after parsing > via sshp_parse_frame(), so we can simply use that instead. Reviewed-by: Andy Shevchenko > Reported-by: kernel-test-robot > Fixes: c167b9c7e3d6 ("platform/surface: Add Surface Aggregator subsystem") > Signed-off-by: Maximilian Luz > --- > > Changes in v2: > - Use payload.len instead of getting the frame length directly. Note > that payload.len equals the frame length and is already correctly set > in sshp_parse_frame(), so they are exactly the same thing. Makes it > look a bit nicer though. > > I did drop the ACKs/Reveiewd-by in case you want to check that > yourselves and since that's essentially the whole change. > > --- > drivers/platform/surface/aggregator/ssh_packet_layer.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/platform/surface/aggregator/ssh_packet_layer.c b/drivers/platform/surface/aggregator/ssh_packet_layer.c > index 583315db8b02..15d96eac6811 100644 > --- a/drivers/platform/surface/aggregator/ssh_packet_layer.c > +++ b/drivers/platform/surface/aggregator/ssh_packet_layer.c > @@ -1774,7 +1774,7 @@ static size_t ssh_ptl_rx_eval(struct ssh_ptl *ptl, struct ssam_span *source) > break; > } > > - return aligned.ptr - source->ptr + SSH_MESSAGE_LENGTH(frame->len); > + return aligned.ptr - source->ptr + SSH_MESSAGE_LENGTH(payload.len); > } > > static int ssh_ptl_rx_threadfn(void *data) > -- > 2.30.0 > -- With Best Regards, Andy Shevchenko