Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6140129iog; Thu, 23 Jun 2022 12:10:49 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ty1UN46zBvpWI2Ci/3LI7CnM6y/XHZ1IIjD/K8k1s82RrExqSpJMn1PfO8zsfRzRA+p9KJ X-Received: by 2002:a17:906:c155:b0:708:21b1:dcf6 with SMTP id dp21-20020a170906c15500b0070821b1dcf6mr9549846ejc.661.1656011449215; Thu, 23 Jun 2022 12:10:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656011449; cv=none; d=google.com; s=arc-20160816; b=slFS8Uu9xq68yj2nXaKb5ko7G7eNGExyOj81p4V/5VL9xg0utiWDsS9ptRrDBa7ODE y6ZSYASHhxvPX+2JYokxAuQDQpeYG1TRCk82BHtoCAtJ++6NKWhKX7B7feYvPErhOawV F9AXFxSOVRMbFeY0iH5hWCGgl41y08LtlE1en3pwEf0BnQ7tuszIjiMrri5FGHxcCpR6 lyctrXUQD3KBYQLVCTlTFxOAcXiUkc7zWIbvs+v0Qoge4w2tDcRtxqF9FarJWivv7E2i LD/Av2JMcPDUCbslEQ7RaN6U6jrT9drWn5crcjzu7TX0hZDRJRb4OuWYh2dBXlMGiu4O VYtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xT6/ozKONTIy11KQfp/1Dl7si8KbLMwihfx8PBNngCQ=; b=M+rJ0Wzol9jUaeavhOYjYhJMS0BJHIx3F/gpRnbGWRJprDsb7LQYXn+qXZIjmtZ1fW ilRN5Ln8ZHcIeFPlNT0IUqU8UQ4T8Jz9CdJ4i7ln1pS5hufJdTcJuvQsAxm4MXbGT+0X xbc3pKUFAmyMqaAm64TIYu5VYZAZwYa2KUv1qMvzimwqYQHA+6sst+OktwNjkRohq9xL VhC8uBYH6rL5N6OjR+iXaVdjtBV/L2TzNxmLN9Xq8NzvU7KLRiEGCtCscT6cxM9Od296 KvX5L6uH+MM72rAc4lUTlS/9n7Erft1dAubZJ/59WGIrPFrCYDntTtOy4oq+9xMdXJvK UmlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QebB3Elt; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ec48-20020a0564020d7000b004358a8128d0si343750edb.296.2022.06.23.12.10.24; Thu, 23 Jun 2022 12:10:49 -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=@linuxfoundation.org header.s=korg header.b=QebB3Elt; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233791AbiFWQ6c (ORCPT + 99 others); Thu, 23 Jun 2022 12:58:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233448AbiFWQu6 (ORCPT ); Thu, 23 Jun 2022 12:50:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8ADF4F47A; Thu, 23 Jun 2022 09:48:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C4CA261FBE; Thu, 23 Jun 2022 16:48:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 906B6C3411B; Thu, 23 Jun 2022 16:48:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656002934; bh=IX4mseEFuNwBYpCLfcO/81qGoeM9zNi0j4CsRWggGjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QebB3EltTGxxgnLvdEO0uOcvlvKxl9VEd/9Wsmby3ecTbH/TBM0yGw9PNrMyfnkZC pjCS3mOJPI0RYociyaLRpkYeNmZvthscmczSZqlYM/kdT0QPNGT6W9Vrmiafo3Hpde kNbjlWnAXcFVPEGOCh3QK4rVSdP+FpgnNX/nDky8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ard Biesheuvel , Richard Henderson , Mark Brown , Theodore Tso , "Jason A. Donenfeld" Subject: [PATCH 4.9 073/264] linux/random.h: Mark CONFIG_ARCH_RANDOM functions __must_check Date: Thu, 23 Jun 2022 18:41:06 +0200 Message-Id: <20220623164346.137289222@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164344.053938039@linuxfoundation.org> References: <20220623164344.053938039@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Richard Henderson commit 904caa6413c87aacbf7d0682da617c39ca18cf1a upstream. We must not use the pointer output without validating the success of the random read. Reviewed-by: Ard Biesheuvel Signed-off-by: Richard Henderson Signed-off-by: Mark Brown Link: https://lore.kernel.org/r/20200110145422.49141-7-broonie@kernel.org Signed-off-by: Theodore Ts'o Signed-off-by: Jason A. Donenfeld Signed-off-by: Greg Kroah-Hartman --- include/linux/random.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/include/linux/random.h +++ b/include/linux/random.h @@ -96,19 +96,19 @@ unsigned long randomize_page(unsigned lo #ifdef CONFIG_ARCH_RANDOM # include #else -static inline bool arch_get_random_long(unsigned long *v) +static inline bool __must_check arch_get_random_long(unsigned long *v) { return false; } -static inline bool arch_get_random_int(unsigned int *v) +static inline bool __must_check arch_get_random_int(unsigned int *v) { return false; } -static inline bool arch_get_random_seed_long(unsigned long *v) +static inline bool __must_check arch_get_random_seed_long(unsigned long *v) { return false; } -static inline bool arch_get_random_seed_int(unsigned int *v) +static inline bool __must_check arch_get_random_seed_int(unsigned int *v) { return false; }