Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2453346rwi; Fri, 21 Oct 2022 04:09:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4YHmNoMzWf9CZxbrRbaRhC8JHF6DXiYQy7rOPOPAeZzTOwA11F/FIsvjJ9iRQD/FWIRRo3 X-Received: by 2002:a17:903:509:b0:179:ffcf:d275 with SMTP id jn9-20020a170903050900b00179ffcfd275mr18845258plb.150.1666350581304; Fri, 21 Oct 2022 04:09:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666350581; cv=none; d=google.com; s=arc-20160816; b=Ir2urPXnKabtuRkbchta2pDQ8KUSreauuI1PPdY5xr19K7ryYamz3RT0mppw/qLCjv oYTjJHBDeUate/BLTzBP7tKFXS52/nkHXUCg8aPsr21h/gp8wWR+8Q6PxCo6PkRmiKRx aOFz9pO+vL1IMotymjGosBzqMRVGp7QGtYZACMHdjsDeTArGnp0Xrdm4qPqqcj4GpHjB zpAGdpc9+HYJcd7YL8KF/q9sK9/PY7/1A2G1+2i2H3VI0KArGQhKkfGbNW+oKSDnDeUh 8MfKIs5OYmmD4NQ4ASJMO2ixSlD6n0NxECaBcGjTyAwVUGXYS49S4VVXOwipSuJQyFoB gmDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=Za+SONx9FuqbfM12ClF5Cp/+gi925kNZnyxgujZpLSI=; b=RyeLq/ABGv3IMBsvZZSTBRQIm/kq+uq7wwm6Z6GMhHQYDUdvZY/5XugprJebqm6LQc C/eYKbNF9Ot6JkwZC4Pv3KgHeUeqMT8cXKbMfeCeCtxNGiffJ9jzEpVlF566ogKpgp+v DYMlqgby9s27fsW/n9XaALaoEhX2WLXd0r57dbrAo15s18qp6YuDR7tFoE7/5TMyAIaw 1BJCVxKEBWlgON2/U1POGPq+zQ92yD8Ica/fmuI2advSM3k9Y+xCSagiBg0AWbUNROwv Eb469jN04lctbJTgoENrsZmTslpp5K1dDLFsKFjBnRmlZHz85LYS3GqgECTQq5GBpBuy uskQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=DyZpQ0C+; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v13-20020a17090a458d00b001fe280041e8si5984602pjg.37.2022.10.21.04.09.29; Fri, 21 Oct 2022 04:09:41 -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=@gmail.com header.s=20210112 header.b=DyZpQ0C+; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229542AbiJUKgE (ORCPT + 99 others); Fri, 21 Oct 2022 06:36:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229940AbiJUKfs (ORCPT ); Fri, 21 Oct 2022 06:35:48 -0400 Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70C5BE4C03 for ; Fri, 21 Oct 2022 03:35:45 -0700 (PDT) Received: by mail-qk1-x72b.google.com with SMTP id o22so1707764qkl.8 for ; Fri, 21 Oct 2022 03:35:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Za+SONx9FuqbfM12ClF5Cp/+gi925kNZnyxgujZpLSI=; b=DyZpQ0C+jrknGd6nJ/f/iHuWj77lfftkQHQiuwxEiibZXV6aHOp4T/fv5lqJijDm4+ aJvslSn2xq6g9Pc0vQaibGyyQJMXVi3Bul3byrf6mUMcQfFvrLgosbpWSXTR+ZsNecPV 3vGvroDOVBc4cv9FINmGhOvDHTWlQA8AEd81rKjCB22jwKOGfppepRYDPmaBu9R1Dc99 LZ+o7Wc5rC/EyEbBbZUZ45AaNB3rTnrxCLWHK1Yv/n8ZP5CVJdsSRDhlRc4t1LMikJGL 7Fnj7Srmr0IQFvQNnCGG7cF+hE4DL4LMpmxsEJx2cgev0Dlv4i6S2JbmvvezAE7HQHGr W8xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Za+SONx9FuqbfM12ClF5Cp/+gi925kNZnyxgujZpLSI=; b=V2jyKuFJVN0OREb7c9NrZaidIpooRIok+L3FNVK0WYDXig7GYE/wHeTBEqjxE2woQR kaT6yI4qFaNDnzArRNp1lVKFHy+X8QmBtRNlDPULtRmK0ePU2oy1/lScDeEsxCk87Rq8 +YRvzxB1U63wUn0vHMArl4fmJA91hFLaFqOtWSmZ2UOoXZ9ezoq8DQ60btnr/yyvypvt mu5FlNvcHA2YIUMC6sUDLsE3QD7Z7RyvzhBBZs5lj2pFeiRNayfqAM/GH3XPBLlTvW/2 mraaVwIro+yoZdkp5UA3LwoIV++QzUzZp3A9HHujaQ18/MmeTqqQC2jTNS7R/EaTRtxy cw3w== X-Gm-Message-State: ACrzQf31sWJdHOrjDZ7/8Ye1or0s1TSGoUKxIA3I+qy0PH1bQNPqDI8O oAadKX/fPJAm+POAM/kQkFDxbLJmJJggJSUrkQc= X-Received: by 2002:a05:620a:410e:b0:6ee:b96b:a831 with SMTP id j14-20020a05620a410e00b006eeb96ba831mr13512410qko.734.1666348544126; Fri, 21 Oct 2022 03:35:44 -0700 (PDT) MIME-Version: 1.0 References: <1666318661-11777-1-git-send-email-u0084500@gmail.com> In-Reply-To: From: Andy Shevchenko Date: Fri, 21 Oct 2022 13:35:07 +0300 Message-ID: Subject: Re: [PATCH v2] mfd: mt6370: Add the out-of-bound check to prevent the null pointer To: ChiYuan Huang Cc: lee@kernel.org, matthias.bgg@gmail.com, chiaen_wu@richtek.com, cy_huang@richtek.com, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 Fri, Oct 21, 2022 at 12:58 PM ChiYuan Huang wrote: > Andy Shevchenko =E6=96=BC 2022=E5=B9=B410=E6= =9C=8821=E6=97=A5 =E9=80=B1=E4=BA=94 =E4=B8=8B=E5=8D=885:14=E5=AF=AB=E9=81= =93=EF=BC=9A > > On Fri, Oct 21, 2022 at 12:02 PM ChiYuan Huang wro= te: > > > Andy Shevchenko =E6=96=BC 2022=E5=B9=B410= =E6=9C=8821=E6=97=A5 =E9=80=B1=E4=BA=94 =E4=B8=8B=E5=8D=884:34=E5=AF=AB=E9= =81=93=EF=BC=9A > > > > On Fri, Oct 21, 2022 at 5:17 AM cy_huang wrote= : ... > > > > https://www.kernel.org/doc/html/latest/process/submitting-patches.h= tml#backtraces-in-commit-messages > > > > Have you had a chance to read this section of the document? > > > OK, get it. > Is the below text enough to express this problem? It is you who decides, because I don't know what exact problem this will represent. > Ex. Testing as below (mt6370 register range from 0 to 0x1ff) > rg_bound_show() > regmap_raw_read(regmap, 0x200, &val, sizeof(val)); > pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=3D--) For example, why is this line here? > pc : i2c_smbus_xfer+0x58/0x120 > lr : i2c_smbus_read_i2c_block_data+0x74/0xc0 > Call trace: > i2c_smbus_xfer+0x58/0x120 > i2c_smbus_read_i2c_block_data+0x74/0xc0 > mt6370_regmap_read+0x40/0x60 > _regmap_raw_read+0xe4/0x278 > regmap_raw_read+0xec/0x240 > rg_bound_show+0xb0/0x120 The rule of thumb is that it's okay to shrink to ~4-5 lines (in most cases)= . --=20 With Best Regards, Andy Shevchenko