From patchwork Tue Jul 17 13:53:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 142148 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp3692416ljj; Tue, 17 Jul 2018 06:54:00 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcgzEtf38aiEv3ALipKFna4nox0sqy2oYmDDEme3/9RQLAJG30SbwBzlz4hfI43CrBc04dD X-Received: by 2002:a17:902:14b:: with SMTP id 69-v6mr1769688plb.184.1531835640712; Tue, 17 Jul 2018 06:54:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531835640; cv=none; d=google.com; s=arc-20160816; b=Uv1AWJoruoUsS58QwrKMdVDC1SQppLfquDzijiHQ5OZAihCLBaGxnDrG4EJST/n6Iq fZ1ZTFOAYLSKTz/iv7rNP851xrX3xVgo5+7Vr1LEGonZgxJKBRCOy088e3miO9YjYJ5o kBmQDbKWdmkm7f4PZzlqZrDqVMa8okSFNtvnDOW5m+TPiRlVYtDJP5WILjGRn80FtEgP xMMQAFEnJJx4sI9xA9NlY3YQbn9h/VkxGH7GyUByQCgQoGTmpsqeoIu2rvYYm3C4Wmm0 SizrnNwsmuJbISB29M1bUKm4kiJoO+fnsChNtugXVK+nngNz32wLrIS3pTlGx6wPLzsN eIIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=IqDe9y90v5JwJJpWTH+jwF4UVyzSa3RJ8Ihm4myAPd8=; b=JAXzzte7HQnFR/qUgE/F7o5k0PqJGOiImwUK7PUbn0Vd0ozsGlF3HhilEzdbcRVLcu GHPhuScHhw98gLDCq+SVZnFZ+a35ySnS8qahkudNN1A1M8hfDqHGe4sVLwyRGhAvfCOM lZEw2gGE7eWdR8JrD0ODH0cwrhPfer1CkjPt8urTe7mvrxTPuzda/DbjIY5S2GnG53Vr qzkuNEL7wx0bz5zY/cvLaPDrjHeMfgXtBy7z39vtox4o4uD5mgGJs6kBfQxlaoDxCe5c UrnRIk6EqTXNsIIne6BZ3++mJHQ4/wtqjUmQ6wQTrVTlNUSryeSMQlyxy/P4Nn4wG3MX 8YKw== ARC-Authentication-Results: i=1; mx.google.com; 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 c13-v6si837148pgq.316.2018.07.17.06.54.00; Tue, 17 Jul 2018 06:54:00 -0700 (PDT) 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; 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 S1731741AbeGQO0o (ORCPT + 31 others); Tue, 17 Jul 2018 10:26:44 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:58031 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731615AbeGQO0n (ORCPT ); Tue, 17 Jul 2018 10:26:43 -0400 Received: from wuerfel.lan ([46.223.138.35]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.145]) with ESMTPA (Nemesis) id 0Lsf1t-1g37JF2Aif-012DLU; Tue, 17 Jul 2018 15:53:08 +0200 From: Arnd Bergmann To: "Theodore Ts'o" , Arnd Bergmann , Greg Kroah-Hartman Cc: Jann Horn , "Tobin C. Harding" , Rasmus Villemoes , Eric Biggers , linux-kernel@vger.kernel.org Subject: [PATCH] random: fix rdrand mix-in Date: Tue, 17 Jul 2018 15:53:00 +0200 Message-Id: <20180717135307.3713325-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K1:WZgbE637AAgQW4ChcH5dH8Sl4SIv1Fo5xxxZYegee96rlF0ZFCk Eu9pBEswRiWNfVXXKjvg07PBhpJZKn31b95OfwFwmvZDQ1cDz4g1ktbtYjSDsRnUkt9LSUo wYX8X07xqMJ5agcRoFLqzXPcieJXkjZvUyAa1MylVmtDxqvw6+6C64T8vtE5F8Ijk0yOYQb RTmJBBZzL7IweNUfaClEA== X-UI-Out-Filterresults: notjunk:1; V01:K0:VD8pRcCibbQ=:vLDYu1to3c6uBFHQ7a2Vry V5u2lhjT3ZXNj/Xt9KLCCL3gFjbjHlQbpnhNZA86yl1QW/V2GtG6YLOU0nJLLAlpuINFsJVfh jC71TPXLfs6d7TLdPInY/gNAfgVNyRMyqPdstF8lDGi2uf0rImdkjlS+X3Axf4dIe5FCocSa2 OQTCXuQh2871uS6f5Q7A7PvViPHx1onXFVQ+7WDao2FDGbMxicB60uMOs7lRzRGMtQViX8DMl cVMaA+xl9opQ66x/W56YaBzFbLzvF98JKidE5/esPzCJIRJBke65CCdf+XvJNV/Ump/dVLezv CZwIeO7PARx73U2xkEgM3JxEnWD6bHa15oGJ9s5yexGoQhlrJ/0ou/vk6plQtpqCnNRGx1sUl o8tUUckC5Sn6JQSvRo07d6qT2+bG2LMt+JR77Sfaubi+s5DiangXY9RdIw8hypxjs6gKr2xy/ ZSaFeiUUvoxRGtPBo1+jm88nTOqEsXxBe9IUbcYrm7bjPdrFcpLnNlDYGfBfu6gdjwf1cFBmF RBpnV4g0hbDbJ6sWF7qdsCwL3qTd+zpgP0/XYLnc04XE8auRdwo6GsswTPWFkm2cxLXvbDpdN aAkm4iwyPE7dnJC8i+gNtZfEybFDxxNV6qpw6BVCas0Ht9WGtdD7Ax8ipHNFc4u8CrRBgNQ2i 5AqOD4ZPpmPR4Yno9QRjA8ijRUcakmg7cyJPs3CRixBypZR/jBxWrlKpZYphFi3VQI3Y= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The newly added arch_get_random_int() call was done incorrectly, using the output only if rdrand hardware was /not/ available. The compiler points out that the data is uninitialized in this case: drivers/char/random.c: In function 'write_pool.constprop': drivers/char/random.c:1912:11: error: 't' may be used uninitialized in this function [-Werror=maybe-uninitialized] This fixes the condition so we only use that data when it was valid. Fixes: 349ddb707fb7 ("random: mix rdrand with entropy sent in from userspace") Signed-off-by: Arnd Bergmann --- drivers/char/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.9.0 diff --git a/drivers/char/random.c b/drivers/char/random.c index 283fe390e878..71660aef8c8c 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -1907,7 +1907,7 @@ write_pool(struct entropy_store *r, const char __user *buffer, size_t count) return -EFAULT; for (b = bytes ; b > 0 ; b -= sizeof(__u32), i++) { - if (arch_get_random_int(&t)) + if (!arch_get_random_int(&t)) continue; buf[i] ^= t; }