Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp463682ybl; Tue, 28 Jan 2020 06:22:19 -0800 (PST) X-Google-Smtp-Source: APXvYqyJx7jWtmoEXlmruOoUC+d+nq0TeRtae4IXXNMzJgkiSPNXlNKuAbRsDczSZLt0OJNdIGos X-Received: by 2002:aca:b183:: with SMTP id a125mr2998047oif.83.1580221339202; Tue, 28 Jan 2020 06:22:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580221339; cv=none; d=google.com; s=arc-20160816; b=KG1oQENIKTTLJtiPw4kq5IIKpVsepUMg9pcb2HfGFHtGiP9EgBZvE6CRZbFxqK+VgW i2Nr47Xpsi4eANKEg65FLDkYsUnfGtNtijLPBfaxbW0NJVEN37RjlHnoNiEaQCDIUIUn EkYsHa0oEtGokQVwLGxGrpWFaWAAJu6qizuqCq3pi9FeSplqh1pJJNE3Enwa4jxVRfSk uHL0Emntnwj7r/fbTD6vHV1Ejxrddir3LS8Sd/4YcoG5DS/9WAoxTCDTlquOI11Vdo+9 9cDKX2SsjMpCXx6XK3fslwofjPlJSJxsQMVFarQ2KA516Ld0/OV8I6Ujo6t2uVt2xtx7 +UXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Jr8Rzl21aptwTXCw2Yh8pBtOI/TAnSbuP5XoRmSUN/E=; b=R4q9vRdl+g6Jg3mAebdleGRK8b4ahwhAfXn+jd8XFrbFRmn/yvtQZn8W+2zpD7KIg0 k3lI0up8sOf9T47mooNJlDoWpYK53DfVASXxbtNthVVF9ExdKNIQ9MEhvmdgObgciQSz 7l6dRCZnkv4j8vNwxydSWgMUtGc5PpiWybgq5PgW4En84Cv64SC6ZevinBWHfpkVqvh/ eArAw0buEIj8ffkg5og85hfJ4CpU+cGcpoapMR6i1E1rVmO/OibrNlcbeuVMVonTPGYP yQCfaUQAD5T7d/0m8u/l+J+nLV1aazb0T3lzNnbc2MlJfcSGzKRr8RxOBqlDjYx/jvD4 EjmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=d+TPTP+8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v25si2086807oiv.144.2020.01.28.06.22.07; Tue, 28 Jan 2020 06:22:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=d+TPTP+8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731221AbgA1OVM (ORCPT + 99 others); Tue, 28 Jan 2020 09:21:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:46260 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730986AbgA1OVG (ORCPT ); Tue, 28 Jan 2020 09:21:06 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CD22424688; Tue, 28 Jan 2020 14:21:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580221266; bh=ASF5vP46lpF5TKK1BJytUEm2I5lL2WyNXko7tgaDhic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d+TPTP+8bx+U4LajBSCZv/EFggpJhctBfzfxGCYvvgVhf3ZaRWASPau3L7ZcFziOX vb5/l79RqX5OuBSe/pJ9of9FnuGZZx8J4UD31yU8IUDOkSe5Q0vKtpwdvys4phSld+ PINcjdEKl+8uGERPPGGsuHt1aaOShvxoW0tFC2+I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephen Hines , Arnd Bergmann , Nick Desaulniers , Nathan Chancellor , Sasha Levin Subject: [PATCH 4.9 148/271] misc: sgi-xp: Properly initialize buf in xpc_get_rsvd_page_pa Date: Tue, 28 Jan 2020 15:04:57 +0100 Message-Id: <20200128135903.570550367@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200128135852.449088278@linuxfoundation.org> References: <20200128135852.449088278@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nathan Chancellor [ Upstream commit b0576f9ecb5c51e9932531d23c447b2739261841 ] Clang warns: drivers/misc/sgi-xp/xpc_partition.c:73:14: warning: variable 'buf' is uninitialized when used within its own initialization [-Wuninitialized] void *buf = buf; ~~~ ^~~ 1 warning generated. Arnd's explanation during review: /* * Returns the physical address of the partition's reserved page through * an iterative number of calls. * * On first call, 'cookie' and 'len' should be set to 0, and 'addr' * set to the nasid of the partition whose reserved page's address is * being sought. * On subsequent calls, pass the values, that were passed back on the * previous call. * * While the return status equals SALRET_MORE_PASSES, keep calling * this function after first copying 'len' bytes starting at 'addr' * into 'buf'. Once the return status equals SALRET_OK, 'addr' will * be the physical address of the partition's reserved page. If the * return status equals neither of these, an error as occurred. */ static inline s64 sn_partition_reserved_page_pa(u64 buf, u64 *cookie, u64 *addr, u64 *len) so *len is set to zero on the first call and tells the bios how many bytes are accessible at 'buf', and it does get updated by the BIOS to tell us how many bytes it needs, and then we allocate that and try again. Fixes: 279290294662 ("[IA64-SGI] cleanup the way XPC locates the reserved page") Link: https://github.com/ClangBuiltLinux/linux/issues/466 Suggested-by: Stephen Hines Reviewed-by: Arnd Bergmann Reviewed-by: Nick Desaulniers Signed-off-by: Nathan Chancellor Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/misc/sgi-xp/xpc_partition.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/sgi-xp/xpc_partition.c b/drivers/misc/sgi-xp/xpc_partition.c index 6956f7e7d4392..ca5f0102daef4 100644 --- a/drivers/misc/sgi-xp/xpc_partition.c +++ b/drivers/misc/sgi-xp/xpc_partition.c @@ -70,7 +70,7 @@ xpc_get_rsvd_page_pa(int nasid) unsigned long rp_pa = nasid; /* seed with nasid */ size_t len = 0; size_t buf_len = 0; - void *buf = buf; + void *buf = NULL; void *buf_base = NULL; enum xp_retval (*get_partition_rsvd_page_pa) (void *, u64 *, unsigned long *, size_t *) = -- 2.20.1