Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp775518ybb; Sat, 28 Mar 2020 09:46:57 -0700 (PDT) X-Google-Smtp-Source: ADFU+vs3l0yG7K90xoOGBP/E+oAo/4sJZCvluK4c2At5pGSYiriZJIZxFrU+MiJhr3ahKOgOV8yB X-Received: by 2002:a9d:82a:: with SMTP id 39mr3245181oty.82.1585414016945; Sat, 28 Mar 2020 09:46:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585414016; cv=none; d=google.com; s=arc-20160816; b=RB8VbohOOHtDxYVzpwKzi33WnuEIK9UvsKjCYYb1OvZ47DIlmRgrAlXkxvy/piWru5 MBqwvGvOpdik8dT7l5IOy5rAUqtmbt+rNItnRUpw7QmIqrhWlCjvI5JPi5DM1RYnWs7L qZ8VnidRNGZ0+vNZaLgLMcgG0v9ltzQzBCBd9vv6Iymsu2GiS6SYwxSlW5T9oozOyJoQ O2HoB0WXl7r5/8OMuDDe++AMHCBTdTFE7bnjLySA+X2Ex+ISntxaJF5pUgZI6429I5dL hRK/lTh+xjwwRIKWDrhcC+SPVs0S6ONi2faNSK8bzQan9NSCyAEceq77jG2II/xQmyBx /Zjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:date:from:message-id; bh=cZ7JlM2vUx7D7VuBNQ+Cf4X3wYBZ3/WfFXxrE0CKQeA=; b=qKFkl9MCJHwoiZwGH6SJfO3mAOEYm5I8HeaLMAbogtED7FGe5VIZlCICjH7/BM7yCw 6KrX4rTZb1o+7exCEvwZPvK/gV0AJiT6ZFj71bOep9XhwefG79ym/aeDk8dOW63+5bzD jrVwVsIklNHSwdVYwrd7rJHaV/PG3jN7q+Lb0Hd//FH34rG3n5afW6WwMgN8NTAEepCo 0b8lQGLy7r5BXes1ywbEe09doQ9P4936J3RDORYy8M1cMLyAS++Tud31KZiWQ7bTrDnM RXhzswB8OFmBD8AAjyKxTI+YQYnuerXW/pqMjNrcYYyHhkALIjqeA8F4WWlP0d1RSyaK bayg== 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 a21si4911803otk.277.2020.03.28.09.46.44; Sat, 28 Mar 2020 09:46:56 -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 S1727401AbgC1Qp7 (ORCPT + 99 others); Sat, 28 Mar 2020 12:45:59 -0400 Received: from mx.sdf.org ([205.166.94.20]:50072 "EHLO mx.sdf.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727666AbgC1Qn3 (ORCPT ); Sat, 28 Mar 2020 12:43:29 -0400 Received: from sdf.org (IDENT:lkml@sdf.lonestar.org [205.166.94.16]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 02SGhQkO024822 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO); Sat, 28 Mar 2020 16:43:26 GMT Received: (from lkml@localhost) by sdf.org (8.15.2/8.12.8/Submit) id 02SGhQZ8022500; Sat, 28 Mar 2020 16:43:26 GMT Message-Id: <202003281643.02SGhQZ8022500@sdf.org> From: George Spelvin Date: Fri, 29 Nov 2019 19:05:57 -0500 Subject: [RFC PATCH v1 49/50] arch/x86/entry/vdso/vma.c: Use get_random_max32() for vdso_addr To: linux-kernel@vger.kernel.org, lkml@sdf.org Cc: Ingo Molnar , Andy Lutomirski Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Which is faster and more uniform than get_random_int() % range. Signed-off-by: George Spelvin Cc: Ingo Molnar Cc: Andy Lutomirski --- arch/x86/entry/vdso/vma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c index f5937742b2901..beb4ef8f85987 100644 --- a/arch/x86/entry/vdso/vma.c +++ b/arch/x86/entry/vdso/vma.c @@ -227,7 +227,7 @@ static unsigned long vdso_addr(unsigned long start, unsigned len) end -= len; if (end > start) { - offset = get_random_int() % (((end - start) >> PAGE_SHIFT) + 1); + offset = get_random_max32(((end - start) >> PAGE_SHIFT) + 1); addr = start + (offset << PAGE_SHIFT); } else { addr = start; -- 2.26.0