Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8392027ybl; Thu, 16 Jan 2020 15:58:31 -0800 (PST) X-Google-Smtp-Source: APXvYqzOk0/ldOGVS6B4p/8Km9Mv98W99HpWx+pMebcatvunP++ZM8mljhXZcD6h5IxFyeg829pG X-Received: by 2002:a05:6830:1e37:: with SMTP id t23mr4305087otr.16.1579219111322; Thu, 16 Jan 2020 15:58:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579219111; cv=none; d=google.com; s=arc-20160816; b=PuBlTIujJAwFztQ6UGfYy1qEoUBajsVR72afgyXnOyuxTIUSsK7RxyNMLSfaH6rMON FNJBVKbXBicglTgWjm6ckhDh/Z9DyGLnamdQULvKFCw9j1fnzYHNMXFqkYTXqLTnsMQq djEnTURW2V8bgg9+OGVLShvEc60GW4zMz/4pMKuUn1BN0IwauzQ9KbN+DckC7/EzNPpp B9OY+rp2FUsXarxMyytwcRKgn3CseztMy+YpBRDBaEpGx0mR/SiTVamQbF856NnYZmBC gqJxKCBs466OZ9z+Hu4qepOUb+wx8kQELsDMihxDAu+B16ESgpjwjBAdLEG0o7/XsKEl +RIg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SCcxqX8/IvYiB6gZdZT4NkGsdrTozojdpMQ8pa/uZAE=; b=WuGZyH+X9UAtBsg3wBlTVtQF/zp2pwvMg4BuDTlLp6I8TpvLw8IemmG92M/IH+KpPg y+XqMMSYNBavsIuNYcnWvGGzKJH6nWAtPWny3h3iMdzPe0aqHkVved/0naIi7wEUpPD+ 6kN4jq/svj2ifnapbp5QrrlIZaeRiFwu22rReKmcpMMSlj0UGkeI8tVuxvuxQJR4IuSM 6zYeSJX8Tx1wTEgsl0LgBnHodOjleBYXD75qrrwV/Fy9hT2KroK7wyQDmRvlxZqzixV1 M36K49FQ/QxHT6hXOHvhHsDAL8CIPR5wwmEMGQ1UAPW3W3p70DNeMJnsYSRUuKgLfrUD tCCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WS7slYZZ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r1si13857955otk.251.2020.01.16.15.58.19; Thu, 16 Jan 2020 15:58:31 -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=WS7slYZZ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407124AbgAPSHJ (ORCPT + 99 others); Thu, 16 Jan 2020 13:07:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:55428 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393448AbgAPRjP (ORCPT ); Thu, 16 Jan 2020 12:39:15 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A504B24706; Thu, 16 Jan 2020 17:39:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579196354; bh=spz5g/ve8aLq5GcNDc3WxFGNqcdy14iFGeAC8teDM0M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WS7slYZZiXBvYVcPBMAsA/T0VS0aLa5J2/+z9cBLMl99Wlc5eV/DzlmNrnkacnAbJ w2kxihAZw0K6oHrnJJO7bnbi4gGLOks7NVDnYOhL7FmsataMJLazA2YuOChj0mzCNV p4uoscEA65KIIXT7PrMEUmZ67xs5iw6uVIDXoNVw= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Nathan Chancellor , Stephen Hines , Arnd Bergmann , Nick Desaulniers , Greg Kroah-Hartman , Sasha Levin , clang-built-linux@googlegroups.com Subject: [PATCH AUTOSEL 4.9 147/251] misc: sgi-xp: Properly initialize buf in xpc_get_rsvd_page_pa Date: Thu, 16 Jan 2020 12:34:56 -0500 Message-Id: <20200116173641.22137-107-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200116173641.22137-1-sashal@kernel.org> References: <20200116173641.22137-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 6956f7e7d439..ca5f0102daef 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