Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp9028722rwd; Wed, 21 Jun 2023 01:56:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6sSLaIuecOu1zUhm3NpLoVr+dbX9ptHwbNauASJK1+gR3fq7KTWuZx4ucj8vvPQMHMKd6q X-Received: by 2002:a05:6358:f15:b0:12b:de12:617f with SMTP id b21-20020a0563580f1500b0012bde12617fmr5904448rwj.4.1687337789578; Wed, 21 Jun 2023 01:56:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687337789; cv=none; d=google.com; s=arc-20160816; b=w1+BARLlL6WD6RkaMjFuyIvXmeN4ZFfmcDuw45xfjd7LcXgWaiG2LClI/tlpSUyCa3 DLJ8c+5FTn/8SMAhwP2ykz0oGW/AgRdLOkRzvKXRs/g8+cJXQWjpJECYKEPJcwUC2L+b ajyMFAQCVjir3bS1lkG61V5U+SxcqvRClvPCpcGxx6F4nLhNnXviXfsGS092OnKWJAP7 3O4oIN8tCRJkQQbAY/c9sutDK1vAPIRnhmxXW0a7CIqg4LVQwxRGaM+r+eccMas3ypPy N9L5AyFuqHGiVHEOKuDFE6VkiwzLrqz7efKLeOa694F/CwtA0YRuUsVBoDp4UGaBVxcm OljQ== 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=jQMoXMnbWU/uyGYsJxGBmzcur0xnsX6AwrHBtRRMA2I=; b=D8Fc9gLsy/qaL30vP3c20FVJQaGqObeme/TMucIpzAenBq7ZZPCYYqRlEWgoa1FvVX 98raS4MjXiBLqpxxZdsGDpKJebVDWhtnJ86ezAyZGO8IoTQp8jXtzE8AL9z5bDrI0KDV aNpUnfqnFmhoVVGLGyuMWG1Exd8isfFncycm+AQNUVid3Tbzevo3ePGj8livycZVBWzN 8kqOr14/XoGwhKdTBJkHiUOk9PAPPP4gyyjguuCkPiRxxXdhJVOXcBm/EGxXV81mjQbu AFZCvC7qq5xJS9AivBkiEAVyLwmzpTqHQXTkY6LcFgZUxEevTiZGbmj70g92UIoB5SCg 3sEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=lwi7c+pC; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w4-20020a656944000000b005348af160c2si3591346pgq.216.2023.06.21.01.56.15; Wed, 21 Jun 2023 01:56:29 -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=@google.com header.s=20221208 header.b=lwi7c+pC; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231428AbjFUIlW (ORCPT + 99 others); Wed, 21 Jun 2023 04:41:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231500AbjFUIku (ORCPT ); Wed, 21 Jun 2023 04:40:50 -0400 Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB4871FE7 for ; Wed, 21 Jun 2023 01:40:10 -0700 (PDT) Received: by mail-qt1-x82d.google.com with SMTP id d75a77b69052e-3f9d619103dso109351cf.1 for ; Wed, 21 Jun 2023 01:40:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687336810; x=1689928810; 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=jQMoXMnbWU/uyGYsJxGBmzcur0xnsX6AwrHBtRRMA2I=; b=lwi7c+pCIZqb++zcz4hGkaCndThXtwbaE6E9+3J+IxVdpa35rZLHGHXoRgonzS7SHv o6pihBBYWga2wMO84Rd7srilI581XiveFvvsiuO0AtZewj05UbdtBDUahjHZ1WoOECrH lBOTX6JaKh4ezaX794YQ6WxNrrJtpVhafVksKSwpRnKufRB67zUUrWvcphwJuRfQTe9A LgeCT5oPXGAlfpcmFuSS85LC90zDlbIZoxa6n2yKs1vODXcnW91l6Wacugd/xhja+Gq7 7absC1E6pW81iQRaHCJR32mkdPVfyLWfhxqBAAkCXnnYIsgGnXWA4aJwyp6Q8A2Lel9J 6WlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687336810; x=1689928810; 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=jQMoXMnbWU/uyGYsJxGBmzcur0xnsX6AwrHBtRRMA2I=; b=RUQFZUPZ8B7i71r9Bv3K4pJMmp+rfVvFbAysxa5AexJFoYz7bP5fZv7N6iNpdYtxvr epXX8hHXXlF4SR2s0bmFJsOhAR4OakWmd3WiG9E7nvRLLw0cxPgYmOwsyMR1cGJPj2J7 3tM00rfq1uHhzsuE3/BMguvdDKuck4QFQqrRRYCh0lkEBhccLGEiZZ53mTej76aGbh0w 1UWyJM8fJeAf32Nlx5Lw+vUPLiLQS5OblYYieVhifawYfa6iTyCHwBqLXoJqcS9ApWci daeGOm+xG7AJHzdMjnMfBaUFCdVDRJxF1YjsJ5vnEgLWDKJWiyB/+EQ0eil3Lvnaeipl 6pwQ== X-Gm-Message-State: AC+VfDw1pC8Wq2tov2oTj8CE+OxP+4lDFVmwSQTCJBU86niuExHuJal9 fnsB40xouZOUeYUi4PmEeOcw+5OjsUSCy6yzy8NPFA== X-Received: by 2002:ac8:5843:0:b0:3e0:c2dd:fd29 with SMTP id h3-20020ac85843000000b003e0c2ddfd29mr1399722qth.4.1687336809930; Wed, 21 Jun 2023 01:40:09 -0700 (PDT) MIME-Version: 1.0 References: <20230530114216.1420790-1-yimingtseng@google.com> In-Reply-To: From: Yi-ming Tseng Date: Wed, 21 Jun 2023 16:39:58 +0800 Message-ID: Subject: Re: [PATCH] PM: domains: fix overflow in genpd_parse_state To: "Rafael J. Wysocki" Cc: Ulf Hansson , Kevin Hilman , Len Brown , Pavel Machek , Greg Kroah-Hartman , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, marscheng@google.com, n.zhandarovich@fintech.ru Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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 Oh I just found there is a similar patch from Nikita Zhandarovich and it will be applied in v6.5. I think we can drop this patch. Thanks and sorry for duplicated patches. The patch from Nikita Zhandarovich and the discussion: https://lore.kernel.org/all/CAJZ5v0gx7bD9EZKPQWyAAZ6hSKjK4hr-nkrJu84HEK-g2A= MAaw@mail.gmail.com/ Thanks again. On Sat, Jun 17, 2023 at 1:44=E2=80=AFAM Rafael J. Wysocki wrote: > > On Tue, May 30, 2023 at 1:42=E2=80=AFPM YiMing Tseng wrote: > > > > Add type casters to prevent 32-bit overflow before assigning to s64 > > variables. It allows full 32-bit range support for latency and > > residency. > > OK, but is it really a practical problem? > > Ulf, what do you think? > > > Signed-off-by: YiMing Tseng > > --- > > drivers/base/power/domain.c | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c > > index 32084e38b73d..26a04cd8d8dc 100644 > > --- a/drivers/base/power/domain.c > > +++ b/drivers/base/power/domain.c > > @@ -2939,10 +2939,10 @@ static int genpd_parse_state(struct genpd_power= _state *genpd_state, > > > > err =3D of_property_read_u32(state_node, "min-residency-us", &r= esidency); > > if (!err) > > - genpd_state->residency_ns =3D 1000 * residency; > > + genpd_state->residency_ns =3D (s64)1000 * residency; > > > > - genpd_state->power_on_latency_ns =3D 1000 * exit_latency; > > - genpd_state->power_off_latency_ns =3D 1000 * entry_latency; > > + genpd_state->power_on_latency_ns =3D (s64)1000 * exit_latency; > > + genpd_state->power_off_latency_ns =3D (s64)1000 * entry_latency= ; > > genpd_state->fwnode =3D &state_node->fwnode; > > > > return 0; > > --