Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4995338rwl; Mon, 3 Apr 2023 12:43:33 -0700 (PDT) X-Google-Smtp-Source: AKy350ZtXAp01iybpuMN5W91ruqpMhuwCuXFJl9PEr3efkYFe91K9fv1PRVfVzYi3/7mwCMlgazX X-Received: by 2002:a17:907:3e09:b0:93e:82d1:9ae0 with SMTP id hp9-20020a1709073e0900b0093e82d19ae0mr42422754ejc.49.1680551012865; Mon, 03 Apr 2023 12:43:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680551012; cv=none; d=google.com; s=arc-20160816; b=NIe+yMvP9GYGSM6b/YS9AH+y++Hq+mbMRvpim7h0jfivDwvfrWyydmKQ4dRFnIxD6/ 0mp6LkvX8bbGtdIKRVmOCDPdrDCu+TjoOa1R/b3C6AFTf/a5k4TL4xclQdlNqVYZL1xf EbXsJ4LZE2FVxH6SVesHJHG5zpmoezWrFPQz+JKO8J42KFDsdZ39EnpC86nq4QL3Az/u jXTdzh25jJ4/GSTTYA4DHmS7IhPUHFnG60m12F6rg0XgXZ4rW8uuog7sBTfPeB3tCGx8 uwMtl/MKGDWdzjRqpzzMvWb+KHXqUejSp7ChyNJz2m/5top1sOUudkDFG2zeLxMXKkGe oTsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=dVDZhweLWsTSv9fCvQmUSvuBXWZan9fh4o49G/RYkag=; b=N0+oMrFVIcGcO3G94tguNaWBII82XE6fatv9EQeqY/JkCkK/z6I8Gy6YPNCmr4QWZY nzUNpfJAlX+pj0P8YBiT4pJH24//oxpW9NDpEJ8wEPR6MybD1fu2R+V3eNIUCtk88QZg VNy9lL875qKBj3rdYinbfcwASNo6Efm8gqYrWihNZOwr8hru00oe2l0kuGbDCSseTtpA Dcz9P7MA6h/qD6zLI9oyicI0/geUJQlmrEExntTw+FaaLSXYhQMzekc+iTczhDUepb5A XnI71cmeF3ecx0NvvVzDnC3KfxC1lNlMC7Wh+E2RfpXTrIWPJLta4/MG7jLZjA328TZW LaUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=o5eVZze3; 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=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i21-20020a50fc15000000b004fc68e7a3d1si7075952edr.206.2023.04.03.12.43.07; Mon, 03 Apr 2023 12:43:32 -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=@alien8.de header.s=dkim header.b=o5eVZze3; 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=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231327AbjDCTcy (ORCPT + 99 others); Mon, 3 Apr 2023 15:32:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230125AbjDCTcx (ORCPT ); Mon, 3 Apr 2023 15:32:53 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E11C21A1 for ; Mon, 3 Apr 2023 12:32:51 -0700 (PDT) Received: from zn.tnic (p5de8e687.dip0.t-ipconnect.de [93.232.230.135]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 7064B1EC01E0; Mon, 3 Apr 2023 21:32:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1680550370; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=dVDZhweLWsTSv9fCvQmUSvuBXWZan9fh4o49G/RYkag=; b=o5eVZze3bFP2YFld2fvQ9vb7TaCW1W1i/hJl5MSIy98rViO/GMoKY6w+gLIhpQ/8JHwTYq jyLgMYY0ZZhoMkU6rYm2LPXYulcQfMN/yhOML0Vtw+kyZXQx1fPm27D1G2JlU7qRMN7Tjt +x9OWNtIymwUKsUTl5oSIsi7QGXpwFE= Date: Mon, 3 Apr 2023 21:32:45 +0200 From: Borislav Petkov To: Yazen Ghannam Cc: x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/amd_nb: Check for invalid SMN reads Message-ID: <20230403193245.GCZCsp3RjNZFSE5f9s@fat_crate.local> References: <20230403164244.471141-1-yazen.ghannam@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230403164244.471141-1-yazen.ghannam@amd.com> X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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 On Mon, Apr 03, 2023 at 04:42:44PM +0000, Yazen Ghannam wrote: > int amd_smn_read(u16 node, u32 address, u32 *value) > { > - return __amd_smn_rw(node, address, value, false); > + int err = __amd_smn_rw(node, address, value, false); > + > + if (PCI_POSSIBLE_ERROR(*value)) { > + err = -ENODEV; > + *value = 0; > + } Why not put this check in __amd_smn_rw()? -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette