Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp27170975rwd; Mon, 3 Jul 2023 22:24:28 -0700 (PDT) X-Google-Smtp-Source: APBJJlEEBNqtt49Ku6fxnzEQkTX2PpNMCh5V2gT9pPcGJdVbSWE1yENQD8SBDcX6MMwZ/XxbGNL7 X-Received: by 2002:a05:6a20:8e0c:b0:12e:b362:a3fa with SMTP id y12-20020a056a208e0c00b0012eb362a3famr2971550pzj.21.1688448267830; Mon, 03 Jul 2023 22:24:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688448267; cv=none; d=google.com; s=arc-20160816; b=aDIfYOLv+WGvrdtSP0THcO7QthrvR3+doy+vjnV8YnceJw1at47gNIr8wSUZjkf9ls jO4ymS4MSt0ug5AbVmXytJ038P7IEMM3EkBMc2ziF0i0sY9AhjJx5j3Tu7rMKH6Gt072 0B5NNweYLlkumjR25lacQbsE9AxdXpyolxf1qUnsojOs3Xhhl9vA9LvP7yRnm5Teykuc AUn00tFM21C4CKxSbFPESiUOCkSHp2A+NZQ7n87Ifno+28HHIwLZ1xkRC6ZMJhjF5Wvz 725C5JNEmOCt/j2zT4pZRIfZzi0Pbyx8pkQtVztPMTCB/KpCJBL+hfW3zna06Hczjty0 GRuQ== 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=4oXmtSzlPkbqT3hFau3fNKFgcjtLAPmoKdlRgdjPPm0=; fh=QsLXn1SO75Qt4VBPQkmcdgtQvHy7sUzy/XtTw7O5ucs=; b=xRzuysgOR59il6GeAdeCYK6v3EVCCFqWf1MD354Jej4avDXJwuS/yqrYlnKhAWRog+ 1fiIaNztN7JM84yupl982WVDRRY8heynJxjbAI5tdtLdKDzhEap9qRF9NHwQNtsTIzwr qbVmJ6xfhgXRyAH7E7OJRxujYYaq4AgOlhhcSLONT7DQcGDI7Uvw8zS3PO06+5zch+M3 /+09Vomaol+v54R6oJVg4FhXcOOP2pVjvVSwCP0kzqymGHB+Ak0Hz2Am2Jtm9EvH3YBA fD4Ilb1GzGs5hJC7JstM+2R/aNc++rT0YphLQ14v78Ld9h2fEcCnrLRlOnGk/+acr1sX cwhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=GyYKyRs1; 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=canonical.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i9-20020a17090320c900b001b7ecbbaa13si17344742plb.152.2023.07.03.22.24.13; Mon, 03 Jul 2023 22:24:27 -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=@canonical.com header.s=20210705 header.b=GyYKyRs1; 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=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229938AbjGDE7i (ORCPT + 99 others); Tue, 4 Jul 2023 00:59:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229915AbjGDE7h (ORCPT ); Tue, 4 Jul 2023 00:59:37 -0400 Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 136071AC for ; Mon, 3 Jul 2023 21:59:35 -0700 (PDT) Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id B4B593F328 for ; Tue, 4 Jul 2023 04:59:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1688446768; bh=4oXmtSzlPkbqT3hFau3fNKFgcjtLAPmoKdlRgdjPPm0=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=GyYKyRs1NTaQR0fuI94h5c6a0cgh/YHX1tUL5G3WoeLN1OAPX9GLiO34U1b5Ve6HW 3uKhajCnPk4lfPrutZ+jadPn0S9PPcaaaMFaudUh/ujEK19xUZ96AQTX5G/kIDPg+M PTZyF2/1jaUdej3aJzZHjLxQlcTZMGyrHCsNbj/DWzxOnfK8T/owIskzG2pgXcv10L ATkakrK97gfK0Xf210HlgItA4vysh8svavC90rxTFl4zUDkFeZlG2tH9obUI5eD9N9 cSTyvTlIcypQC9ALy6Z2EqMikcuqNGm0Dl5nfX8BiaHlRBzjBpFrvOti5eVu3VjHeM OrgxF4W0tf2bQ== Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-635f38834acso56369646d6.0 for ; Mon, 03 Jul 2023 21:59:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688446767; x=1691038767; 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=4oXmtSzlPkbqT3hFau3fNKFgcjtLAPmoKdlRgdjPPm0=; b=bLpyQLI88JjmsabXSgIDHPCtJlUiuTdENSwPGDcn7Hieub+bI7TGqh/NticBZmJXrU MbSJ9lJNpd94LRok3NnU8YaeXaB6JN6bXiUSXAClJpIBI4ZUxV5veUkNs0cPIWEgCpGz RU38F2kxkugPWNjqno16z8yy2mUzPjcHqeh9KxG5DuZL2H/ZRFTFIQdyx5MfuNZtCDNO i55n7ztH/OithgduE/biehncsoRGCvvaqzS9gg2/bSXGD8FNST6OT1/sDHY/z77FTm1W 4rMsjbr7pcQd90alCoE47TSGGgfhu1zUZslZqQdWMpku8Hyi9bI/znV8WbDMVgHB0VMA OiMA== X-Gm-Message-State: ABy/qLb9gq6UZ6i1nxpqND/uMyU0lWudIh4A72qvSeKsBF++GYKTE2VV VoQ5hZeKsTkaUy63EfaohuyvW8ONyFH7O9pspIldHSWrHMC3GNXHgx7/EmVmuZZQR7vyuIk+XQB IJZwQDngR05non3ZgWdXmAcgxITYqtKpF9WSz49Nbl6GxsG5FNCpNDMV9Rg== X-Received: by 2002:a05:6214:519b:b0:636:afa1:344f with SMTP id kl27-20020a056214519b00b00636afa1344fmr8702949qvb.47.1688446767685; Mon, 03 Jul 2023 21:59:27 -0700 (PDT) X-Received: by 2002:a05:6214:519b:b0:636:afa1:344f with SMTP id kl27-20020a056214519b00b00636afa1344fmr8702934qvb.47.1688446767466; Mon, 03 Jul 2023 21:59:27 -0700 (PDT) MIME-Version: 1.0 References: <20230703162509.77828-1-koba.ko@canonical.com> <4ec2b7d2-11a5-6ab6-087a-175ed31faca4@web.de> In-Reply-To: From: Koba Ko Date: Tue, 4 Jul 2023 12:59:15 +0800 Message-ID: Subject: Re: [PATCH v2] EDAC/i10nm: shift exponent is negative To: "Luck, Tony" Cc: Markus Elfring , "linux-edac@vger.kernel.org" , "kernel-janitors@vger.kernel.org" , Borislav Petkov , James Morse , Mauro Carvalho Chehab , Robert Richter , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 As per suggestions, i modified V3. could you please take a look Subject: [PATCH][V3] EDAC/i10nm: shift exponent is negative Because failed to read from DIMM, get the negative value for shift operation. `EDAC DEBUG: skx_get_dimm_attr: bad ranks =3D 3 (raw=3D0xffffffff) EDAC DEBUG: skx_get_dimm_attr: bad rows =3D 7 (raw=3D0xffffffff) EDAC DEBUG: skx_get_dimm_attr: bad cols =3D 3 (raw=3D0xffffffff) EDAC DEBUG: i10nm_get_dimm_config: dimmmtr 0xffffffff mcddrtcfg 0xffffffff (mc1 ch0 dimm1)` UBSAN complains this error `UBSAN: shift-out-of-bounds in drivers/edac/skx_common.c:369:16 shift exponent -66 is negative` when get rows, cols and ranks, the returned error value doesn't be handled. check the return value is EINVAL, if yes, directly return 0 and show error message explicitly. Fixes: 4ec656bdf43a13) EDAC, skx_edac: Add EDAC driver for Skylake Signed-off-by: Koba Ko --- V2 -> V3: simplify the summary and add 'Fixes:' V1 -> V2: make error-print explicitly On Tue, Jul 4, 2023 at 10:20=E2=80=AFAM Koba Ko wro= te: > > On Tue, Jul 4, 2023 at 5:51=E2=80=AFAM Luck, Tony w= rote: > > > > > > UBSAN complains this error > > > > ~~~ > > > > UBSAN: shift-out-of-bounds in drivers/edac/skx_common.c:369:16 > > > =E2=80=A6 > > > > ~~~ > > > > > > > > when get rows, cols and ranks, the returned error value doesn't be > > > > handled. > > > > > > > > check the return value is EINVAL, if yes, directly return 0. > > > =E2=80=A6 > > > > > > * Please improve this change description further. > > > > To be specific. Initially you reported this because of the UBSAN error > > report. But, after community discussion you now know that the problem > > is that one or more of the rows/cols/ranks has a value that the EDAC dr= iver > > doesn't expect and probably can handle. > > > > So, in V2, the commit message should start with the information these > > values are out of range and mention this was discovered when UBSAN > > put out a warning about a negative shift. No need to include the whole > > of the UBSAN stack trace. > > > > Then describe the two fixes that this patch includes. One is to change = the > > edac debug message into a console error message to enable further > > debug of this issue. The other is to skip the unrecognized DIMM. > > > > > * How do you think about to add the tag =E2=80=9CFixes=E2=80=9D? > > > > This is a good idea. Use git blame, or dig into the GIT history to > > find the commit where this code was introduced (hint .. git blame > > says: > > 88a242c98740 ("EDAC, skx_common: Separate common code out from skx_edac= ") > > but that obviously just refactored code, so you should dig back more in= to > > the history. > There are two parts, > 1. @get_dimm_attr, edac_dbg was added since e235dd43d8b0f0 > 2. get num of ranks, rows and cols, 4ec656bdf43a13 > > Should I add all of them prefixes with "Fixes"? > > > > > > > V2: make error-print explicitly > > > > --- > > > > > > Would you like to avoid a misplaced marker line here? > > > > > > See also: > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tr= ee/Documentation/process/submitting-patches.rst?h=3Dv6.4#n686 > > > > That's an excellent resource. > > > > -Tony