Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp586277lqs; Thu, 13 Jun 2024 22:05:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW4R+s3dhO5JvoU6yNRNZ7XSTvi13+xYBFyZ8zeZKJakeqfsx48HHIW/EWQQfEyzn/7AwqrQ6w1WQ2QxFHy9A8NWRugi+5CMHGKI/ZBdQ== X-Google-Smtp-Source: AGHT+IGgVxxQb+Lysi5o3CLlS51T5rBpxy4VRWoJORW+dPrmlPO9KJ3QwiKjO8C9G2C3+0UkxahC X-Received: by 2002:a25:2981:0:b0:dff:18a4:2b9b with SMTP id 3f1490d57ef6-dff18a42e56mr956164276.51.1718341516073; Thu, 13 Jun 2024 22:05:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718341516; cv=pass; d=google.com; s=arc-20160816; b=d7gUfH1o686MAVypXvDXXu2NbagwQXq/3CQywhQTjzOpDjIm8PTJZB8rsHlPL0FvXF kkKpPx1ajaTrLgiWiHMJj+WSxz374BJSpFCQR+BMdJdgwIVKm7CGSCaB8pyXsjPuWwVv xWfZTX+exjCsWZwOQrWoGrpkaMMJT/gu/9xWNuY2WbxxuFl1y1nUXqp2j1nWtkHJv/P2 dZafHb7lIlt5xbS7tYPuQnc2GsvOKS/HHEeTKsM/NPrAg5aPhho9+xE9P2nqIpvJ8sGU 5aBskez9QYXzROMB/RdrdqTYvnsQi05S4h3rONnm0DEDz4j4xurzFGdrDyyzQY1a5jEA QGlw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=EWNNIgMpJqUN8OKFztHzayuDCT95LOD3ZJqMZeNQQ+c=; fh=PGBDJb0nBgY0ZCn2ABbHcXHqG+U1uaUQo5VORW/MDss=; b=dzJHnJPRsrdip77QtRyrfXiQzaGkMrQV+R0mikCuhdQqiDOhKJl9g0uBcUAxOP1WGO UnmJzt4P43J+QXAGsZ+60iQBZexL3+uxjNjODFwjUlpFjmuyIFuFSiuqNzzwx6L1KKYj O5DQaOpzGRXiQWmmco9Y1SKG1wRX9iqffoDpVce/ti5icuWivFPyw6QLvAxZ83AJXuK2 ewtxKnTIFmFAZfE+fBMp6OqwTIA5QhT+k+7zKeVFBimmqwPvhmL3c1mYPA59eST/ycE5 4oyEALfWoxC2cVkjK+ETlEgEXpYorwG2q/4UnNqTbh8LJKE4h6uzHNtsqfbgp5gZzSvy 3wfA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=frsyOYeN; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-214349-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214349-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-441ef3dc8f1si18690751cf.214.2024.06.13.22.05.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 22:05:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-214349-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=frsyOYeN; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-214349-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214349-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B69121C21B5E for ; Fri, 14 Jun 2024 05:05:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 820CE1474BA; Fri, 14 Jun 2024 05:05:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="frsyOYeN" Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 27CBD12D760 for ; Fri, 14 Jun 2024 05:05:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718341507; cv=none; b=eEeawMfLoUNxrMWo7PGs4VxXaOpt36zXtzGIeTERmShFp9lnKFRQMM2WPu3K7VsafWVyGedzhoUJ5Om/094boDBKz6VCfDH99KrlJcfmbOuZl65h7+9f+NCsX5Hooc44tHCv/UoUx6R67AVytBVs4k0apW9BUbGW8cMa1tGhxv4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718341507; c=relaxed/simple; bh=IukhxcX3qDkzoO5Zy8Nrlq5s8wAmwy+/c7BkQCbdyC4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=n4et2EM2DsElqwfHQ4Afi5F8d6H8xvFY+LabR7jyEln9wJ6sjW+wG6RiavDGk6pCiXjGvww4wK6t18sbMaHJsYFflq1k3Rz9pKxubSwDsnU1grsww2RrUaT2LA1rPQri5TiS2T6eHmDMcTHH89FCxMHL+/jyEFijpBB/86YpQaM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=frsyOYeN; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4217d808034so17494135e9.3 for ; Thu, 13 Jun 2024 22:05:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718341504; x=1718946304; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=EWNNIgMpJqUN8OKFztHzayuDCT95LOD3ZJqMZeNQQ+c=; b=frsyOYeNNhtC5G+KKj+t9vsEKuI8OGC4BgQ2i8q/RDNlss/jTB0geMP/Ys5pIqNQ9n UzInjbAFKZvUv34qm9GzzhtP8Hz1+gvQ0BuvcIIbdllC61rXfPC7ll9f8W0YdliJGNgn 8LhdKVuWOxLPBmtHt+sMD/3QodxEm+uGZwytO+L6iXrG9Bl9995dz5w3bljh0qdAA7Ly 0fS0SY/h+mBWIOYzWA8aj4J0vn38BExFPn2lFmganm80tYH/1U/c5hTKOWAVXG0yUThM 6kAtYcdyKrlfHRpWLf0fOs4jkLpteubLMfBTntLE+3W+dAHGcIPYsDoQ5IBxoCVi1Cuu RDqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718341504; x=1718946304; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=EWNNIgMpJqUN8OKFztHzayuDCT95LOD3ZJqMZeNQQ+c=; b=E0NjC92zuPYopmfgA7MFCYgMdbUrQDLcWVDFK6qy+aAhFb1xIgu2UDSPlOnDITx/iY 4/RecFBuI6INY8iMRPND6lH1zTiRhLNHwoDTpRCFlgPePEi8UDH/FrTiBm1aQNAgaRuv dJQLMAGmxyaeWT0tyYmwXRTQ7qzbEm6mmvwjUL6LvgEgd+O2Et3jMJ+WSP++rwrl/10l LYgt3hjzh3J32P1zQSDORMN37/aiID6vIo7Zxcuv8m3Jp7y4mYekfsU22jbEu5/ys33K KSi9PPm/UIWdUjd8v7Ao3VcuHvqV3OMzLnz8dUsAEh/nWJxjMupNZ5U0lZfKURWFKSIB JNyw== X-Forwarded-Encrypted: i=1; AJvYcCVF+v7vbEaroNnm6GsLcJR4SN3dCxYc3+g2U+QFteomWI5MMFX0dRLcFjXPL1GLRb+kcNBxx0AvQskGJBpfV+GWuQoSfDSWA2JgmMx7 X-Gm-Message-State: AOJu0YyoNodyXNsbsRi0fLgUUBF3zODM6cqiBe518QwuzPLxJnkD3Pfz zqfv4n/ZwtgeXkCdm0N+3XqpyADbH7WO6rA1oGW01/qhJ3mOko8A6ClQWZeOALw= X-Received: by 2002:a05:600c:4ca9:b0:422:52c3:7fe0 with SMTP id 5b1f17b1804b1-4230482c1e9mr16109225e9.22.1718341504275; Thu, 13 Jun 2024 22:05:04 -0700 (PDT) Received: from localhost ([102.222.70.76]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-422874de5d5sm83206355e9.33.2024.06.13.22.05.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 22:05:03 -0700 (PDT) Date: Fri, 14 Jun 2024 08:05:00 +0300 From: Dan Carpenter To: Ben Walsh Cc: Benson Leung , Tzung-Bi Shih , Guenter Roeck , chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] platform/chrome: cros_ec_lpc: Handle zero length read/write Message-ID: <590a7d8c-6bfb-45f1-bc26-d99837cff2a2@moroto.mountain> References: <20240613212542.403-1-ben@jubnut.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240613212542.403-1-ben@jubnut.com> On Thu, Jun 13, 2024 at 10:25:42PM +0100, Ben Walsh wrote: > cros_ec_lpc_mec_read_bytes and cros_ec_lpc_mec_write_bytes call > cros_ec_lpc_mec_in_range, which checks if addresses are in the MEC > address range, and returns -EINVAL if the range given is not sensible. > > However cros_ec_lpc_mec_in_range was also returning -EINVAL for a zero > length range. > > A zero length range should not be an error condition. > cros_ec_lpc_mec_in_range now returns 1 in this case. > cros_ec_lpc_io_bytes_mec checks for zero length, and returns > immediately without beginning a transfer. > > Signed-off-by: Ben Walsh Ideally this would have a Fixes tag that points to my commit. regards, dan carpenter