From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1736C433F5 for ; Fri, 13 May 2022 10:34:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379509AbiEMKe4 (ORCPT ); Fri, 13 May 2022 06:34:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379442AbiEMKev (ORCPT ); Fri, 13 May 2022 06:34:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BF981ACFB2 for ; Fri, 13 May 2022 03:34:50 -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 ams.source.kernel.org (Postfix) with ESMTPS id 4B4B1B82D74 for ; Fri, 13 May 2022 10:34:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D464C34100; Fri, 13 May 2022 10:34:47 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="CVGBQ4r8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1652438086; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jgCALduODQNoXZ2GjV92Rd/XeDog7JIdZbU+zai/u+Q=; b=CVGBQ4r8Y83G9YM/tr/GN8N8Ub5TIgJxOqrQGd18/xuq8akbazLIk2b4tPa+cV6wCR94pB Hc/M/iZ54rDk+OsnEEjUtdpTr1KnoxW5bPHFDxIdfx14cc6aTFUgJMkjrTPIfZ/I0Ka+zT rirNaxI26yFgPpZmOBJkXuccc66dzks= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 430e8ad9 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Fri, 13 May 2022 10:34:46 +0000 (UTC) From: "Jason A. Donenfeld" To: linux-kernel@vger.kernel.org Cc: linux@dominikbrodowski.net, "Jason A. Donenfeld" Subject: [PATCH 2/2] random: use proper return types on get_random_{int,long}_wait() Date: Fri, 13 May 2022 12:34:34 +0200 Message-Id: <20220513103434.287137-2-Jason@zx2c4.com> In-Reply-To: <20220513103434.287137-1-Jason@zx2c4.com> References: <20220513103434.287137-1-Jason@zx2c4.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Before these were returning signed values, but the API is intended to be used with unsigned values. Signed-off-by: Jason A. Donenfeld --- include/linux/random.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/random.h b/include/linux/random.h index 97f879ea78a5..883bf9a23d84 100644 --- a/include/linux/random.h +++ b/include/linux/random.h @@ -90,18 +90,18 @@ static inline int get_random_bytes_wait(void *buf, size_t nbytes) return ret; } -#define declare_get_random_var_wait(var) \ - static inline int get_random_ ## var ## _wait(var *out) { \ +#define declare_get_random_var_wait(name, ret_type) \ + static inline int get_random_ ## name ## _wait(ret_type *out) { \ int ret = wait_for_random_bytes(); \ if (unlikely(ret)) \ return ret; \ - *out = get_random_ ## var(); \ + *out = get_random_ ## name(); \ return 0; \ } -declare_get_random_var_wait(u32) -declare_get_random_var_wait(u64) -declare_get_random_var_wait(int) -declare_get_random_var_wait(long) +declare_get_random_var_wait(u32, u32) +declare_get_random_var_wait(u64, u32) +declare_get_random_var_wait(int, unsigned int) +declare_get_random_var_wait(long, unsigned long) #undef declare_get_random_var /* -- 2.35.1