Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp2237000rwb; Thu, 27 Jul 2023 04:28:18 -0700 (PDT) X-Google-Smtp-Source: APBJJlHIJu1TR0fO8PnIQNNYDE6Nk6m7nJ3J6hDcVclg4uCxSyrjS5XLn7CHG5v30jisBma2kTOl X-Received: by 2002:a19:505d:0:b0:4fd:ba8d:d4ed with SMTP id z29-20020a19505d000000b004fdba8dd4edmr1280797lfj.24.1690457297953; Thu, 27 Jul 2023 04:28:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690457297; cv=none; d=google.com; s=arc-20160816; b=yrcLohJzFXaUscV0GeL9c+wbILMWDB2FmmysQS52PxK8eAVGsd0LMQ1tlIci0PVJ9n vdSH7lW1Qha2W2rqpQygcmpK/ZrMzMyN5vS95EBuLYGhEdPTuEQAicwAahveqD079V4U M2RKo8uvjPuTq5u/v0OskwZUhWhfEqmP95YKzlxyFYvE28wXYX/NlmnJvzI6yPwZy8dL rESq1QHAs8rCEI1usBMtaSmasgjHDay36ViuVCfor+PjNh0MQ0Hy7E9hW9sGv2K8X5J7 TxZLo7e2BGLWS7b/Lm8F0EqkxStSsd7FiUD36tSHkv5pzX79zXmV6344Tf/aOimntDxn QPFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=OX9MDe8NHIh5VO+Htt/SokAWIgZci/YJL6wa1+ObXck=; fh=GZM2klOCd/qrK1UF0WrmtJbjvc+8/Dd/mWJU2xFCkYc=; b=sG0wzgwmKR/j4xC/N2WX8xHLUQUNJNEGc0JaOKVE+X2/RoOMlGWjaEdVCqgCTCwrSH HM5d8hB8dP2j+DYIEIjIX9gLaJQp5rp2lOngEB/jxrPlj7eixDPqAZCnmT152Ou161XK xZpPZ3hpz/vrcswT6+O07XHM6yUAMKSVN1PywZ7K69+7hgpIxuuRjIK97gHf6bBAIseX NSEvwUGiZHb7JfRTqCZDyRePE3DW+NQmpgztYxXEffKAWJLlwExEooMJrN7Q9kH8pgVP Zk3rYa5rxI9677lX0N7zaNJRJ0/CV0p+xzjsD2ZfYfPTJXE0nolhxsL6+kB9Vn+y2mc+ bh4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=P8gqo9JD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w9-20020aa7cb49000000b0051e242852fasi754007edt.584.2023.07.27.04.27.52; Thu, 27 Jul 2023 04:28:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=P8gqo9JD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231618AbjG0Kjm (ORCPT + 99 others); Thu, 27 Jul 2023 06:39:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231225AbjG0Kjh (ORCPT ); Thu, 27 Jul 2023 06:39:37 -0400 Received: from mgamail.intel.com (unknown [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D69FE268B; Thu, 27 Jul 2023 03:39:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690454376; x=1721990376; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=ap72cX/8T3ny+bqu7pGgd944OAjKiuy6FxPkyIxDrT0=; b=P8gqo9JDyWiWqzRJlS5rt/PFuDL/PNOv6nLXfSUO97NN8XM+tWpAK514 G3hJJ7YY8sJNWSqJvTstNt1a797qYGujJwnz8vFrwFHXl8VJ/D/eaTthc ci6atyGHFZVwn9+Y2eu/05hPGIJFFWIwtGtrfchwFNJnnTNqoFbrQZzRM iPaxgnrS/OfmXn5nYHDL9JX0SWvPRecojFufzJC8KHD6vwTckg/EjciB2 H1laNXLt1VQK48BcVairDKGuMtaIKfKC+tevKmBm8/GtkuBPoyEHlChQI UMGCMrRmG73sVjy1bMwxBoOLe8yT70gDogA+9gsrJxCAcePd3PT5vTmVn w==; X-IronPort-AV: E=McAfee;i="6600,9927,10783"; a="368291799" X-IronPort-AV: E=Sophos;i="6.01,234,1684825200"; d="scan'208";a="368291799" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2023 03:39:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10783"; a="720858331" X-IronPort-AV: E=Sophos;i="6.01,234,1684825200"; d="scan'208";a="720858331" Received: from mylly.fi.intel.com (HELO [10.237.72.154]) ([10.237.72.154]) by orsmga007.jf.intel.com with ESMTP; 27 Jul 2023 03:36:48 -0700 Message-ID: Date: Thu, 27 Jul 2023 13:36:47 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.13.0 Subject: Re: [PATCH v2 1/2] i2c: designware: Correct length byte validation logic Content-Language: en-US To: Tam Nguyen , linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org Cc: patches@amperecomputing.com, andriy.shevchenko@linux.intel.com, mika.westerberg@linux.intel.com, jsd@semihalf.com, chuong@os.amperecomputing.com, darren@os.amperecomputing.com, Quan Nguyen , stable@vger.kernel.org References: <20230726080001.337353-1-tamnguyenchi@os.amperecomputing.com> <20230726080001.337353-2-tamnguyenchi@os.amperecomputing.com> From: Jarkko Nikula In-Reply-To: <20230726080001.337353-2-tamnguyenchi@os.amperecomputing.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/26/23 11:00, Tam Nguyen wrote: > From: Quan Nguyen > > Commit 0daede80f870 ("i2c: designware: Convert driver to using regmap API") > changes the logic to validate the whole 32-bit return value of > DW_IC_DATA_CMD register instead of 8-bit LSB without reason. > > Later, commit f53f15ba5a85 ("i2c: designware: Get right data length"), > introduced partial fix but not enough because the "tmp > 0" still test > tmp as 32-bit value and is wrong in case the IC_DATA_CMD[11] is set. > > Revert the logic to just before commit 0daede80f870 > ("i2c: designware: Convert driver to using regmap API"). > > Fixes: f53f15ba5a85 ("i2c: designware: Get right data length") > Fixes: 0daede80f870 ("i2c: designware: Convert driver to using regmap API") > Cc: stable@vger.kernel.org > Signed-off-by: Tam Nguyen > Signed-off-by: Quan Nguyen > --- > drivers/i2c/busses/i2c-designware-master.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > Acked-by: Jarkko Nikula