Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2942341iog; Mon, 20 Jun 2022 07:59:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1txwwkbPSHXFnDBKslmMiEyeIvw7xIpKQFoQNIJqxgOu1gKYLPpPfMcnnLr6270OFDEuTlT X-Received: by 2002:a17:902:830b:b0:168:e27c:1a56 with SMTP id bd11-20020a170902830b00b00168e27c1a56mr24072940plb.152.1655737146862; Mon, 20 Jun 2022 07:59:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655737146; cv=none; d=google.com; s=arc-20160816; b=qOo17xDSsjb6gZdDdZ4A6i/ZN0V7MBE0alHGSNMhiI1oofyTQPlbMDNeL4w6JH2hf/ bSiP6FLVeTLfYLtSCmAhnVRgHa1tIFfL6npSLYsur9TgGUNT5N44McfZ07cqPz0WeCE7 8tZaJ+RRkNsYUmQKZBvESbAm/QGzJqjZnBS3WKIjgDNxYfbSpR+SEjhHzQidqgl/N3PB iS15OIthk92p2AqvSmOk5xcpxIQAmC299CS0+LVmEb88Xk6e8sIwuyDidnZk9dEzoGMX vXiXzYmQD7GxWIxkDXUeT65tz4eUyJmIRhj3cbn0g0vhBcBO8YHgZftUa6i2pUG/gxmC NLPg== 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=67iRSHrn3t1LlESkmt77nTC4dgHSfKQlspKr9Ebs5gU=; b=bzxnBgbrfdosoIl4sm0rHL2h2/mWKwoAl48JXJsvZ2a7aSqJB87GRBS8bfiSLqXTAx YiiuV8+UjNIDvcGy9nGuYNvoRuK04v6kXCy3s1druozDjQoP0TEQb946crNE88cwlIRv oWuHqUszGEfmbcRhagjFZEphN2NafR/B4nfLck31NLK81gafOnnl5Ut58BnF7UXHo3dZ VMfJLf8FDUqRvzcu0a4kWOeWcnWoM1xRaHDG0shM4cGT+8db5BOnLS55hLdqeV4vC421 vuKMIyw+fGc54SHaIaK5uSYorKc06FQ4vD9jQgXgl1k/8eb23MSSYWMObn7kaQkTVjQ6 Mp6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v4ou0V6N; 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 i6-20020a17090acf8600b001ecb74e083asi1572047pju.57.2022.06.20.07.58.53; Mon, 20 Jun 2022 07:59:06 -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=v4ou0V6N; 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 S1351102AbiFTOL5 (ORCPT + 99 others); Mon, 20 Jun 2022 10:11:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352057AbiFTNzw (ORCPT ); Mon, 20 Jun 2022 09:55:52 -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 88CD134BB8; Mon, 20 Jun 2022 06:21:59 -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 95ADFB811D7; Mon, 20 Jun 2022 13:11:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E543FC3411B; Mon, 20 Jun 2022 13:11:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655730667; bh=Se/8P/jaRDfY+UTXLxqdL6SgFPgJump3fH5kjWf95ig=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v4ou0V6Nq9Nv5/etmTHn0JyZTCpZ2r4qk8wYi6ZfexqkIMdpJlWsHR2j6MmDfcM6L T1a52CTtsb3npUP0bpQPRDfu8/h8+zabFHZ7RGHMdiDBGVlqWJccGUPN8rNC9qaGkf Du5dSe80DDi7mpopIorLhlCYUaKniO7UgPT5nRdo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yangtao Li , Theodore Tso , "Jason A. Donenfeld" Subject: [PATCH 5.4 019/240] random: Add and use pr_fmt() Date: Mon, 20 Jun 2022 14:48:40 +0200 Message-Id: <20220620124738.367436228@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124737.799371052@linuxfoundation.org> References: <20220620124737.799371052@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: Yangtao Li commit 12cd53aff5ea0359b1dac91fcd9ddc7b9e646588 upstream. Prefix all printk/pr_ messages with "random: " to make the logging a bit more consistent. Miscellanea: o Convert a printks to pr_notice o Whitespace to align to open parentheses o Remove embedded "random: " from pr_* as pr_fmt adds it Signed-off-by: Yangtao Li Link: https://lore.kernel.org/r/20190607182517.28266-3-tiny.windzz@gmail.com Signed-off-by: Theodore Ts'o Signed-off-by: Jason A. Donenfeld Signed-off-by: Greg Kroah-Hartman --- drivers/char/random.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -307,6 +307,8 @@ * Eastlake, Steve Crocker, and Jeff Schiller. */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include #include #include @@ -738,7 +740,7 @@ retry: } if (WARN_ON(entropy_count < 0)) { - pr_warn("random: negative entropy/overflow: pool %s count %d\n", + pr_warn("negative entropy/overflow: pool %s count %d\n", r->name, entropy_count); entropy_count = 0; } else if (entropy_count > pool_size) @@ -834,7 +836,7 @@ static void crng_initialize(struct crng_ invalidate_batched_entropy(); numa_crng_init(); crng_init = 2; - pr_notice("random: crng done (trusting CPU's manufacturer)\n"); + pr_notice("crng done (trusting CPU's manufacturer)\n"); } crng->init_time = jiffies - CRNG_RESEED_INTERVAL - 1; } @@ -858,14 +860,12 @@ static void crng_finalize_init(struct cr kill_fasync(&fasync, SIGIO, POLL_IN); pr_notice("crng init done\n"); if (unseeded_warning.missed) { - pr_notice("random: %d get_random_xx warning(s) missed " - "due to ratelimiting\n", + pr_notice("%d get_random_xx warning(s) missed due to ratelimiting\n", unseeded_warning.missed); unseeded_warning.missed = 0; } if (urandom_warning.missed) { - pr_notice("random: %d urandom warning(s) missed " - "due to ratelimiting\n", + pr_notice("%d urandom warning(s) missed due to ratelimiting\n", urandom_warning.missed); urandom_warning.missed = 0; } @@ -948,7 +948,7 @@ static size_t crng_fast_load(const char if (crng_init_cnt >= CRNG_INIT_CNT_THRESH) { invalidate_batched_entropy(); crng_init = 1; - pr_notice("random: fast init done\n"); + pr_notice("fast init done\n"); } return ret; } @@ -1384,7 +1384,7 @@ retry: ibytes = 0; if (WARN_ON(entropy_count < 0)) { - pr_warn("random: negative entropy count: pool %s count %d\n", + pr_warn("negative entropy count: pool %s count %d\n", r->name, entropy_count); entropy_count = 0; } @@ -1870,9 +1870,8 @@ urandom_read(struct file *file, char __u if (!crng_ready() && maxwarn > 0) { maxwarn--; if (__ratelimit(&urandom_warning)) - printk(KERN_NOTICE "random: %s: uninitialized " - "urandom read (%zd bytes read)\n", - current->comm, nbytes); + pr_notice("%s: uninitialized urandom read (%zd bytes read)\n", + current->comm, nbytes); spin_lock_irqsave(&primary_crng.lock, flags); crng_init_cnt = 0; spin_unlock_irqrestore(&primary_crng.lock, flags);