Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp14475396rwd; Sat, 24 Jun 2023 21:15:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ52zhx2rJezKe1H48gw9BEQLHRJSG8rn54YVniUfdSGfz1HiqtIGek+LsWbtEKYMSQeky/K X-Received: by 2002:a05:6870:a2c4:b0:192:f48d:72e3 with SMTP id w4-20020a056870a2c400b00192f48d72e3mr20920977oak.33.1687666551938; Sat, 24 Jun 2023 21:15:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687666551; cv=none; d=google.com; s=arc-20160816; b=i77vktHJlAUiqXsk5EgknyE7yHjEnO6QJvdzxqb67y3l35pOBq57gm6qDVMVAO7sJk rpMVTGm1tK0KFyohP0h9h1uDZS6+wYtDYrviQiOa65z+6Og4/janW7kDlhXWpwWEGasz gmKXewhuiRfWD219lwYAZTzajIv0gb/obGAxRNRjYlPWZJ4ARVUMDxtJnBolIL6ti3A5 IOISnGRMZcgOEHUe7/d3iGhq1IJk6NjxdXQg/N4/lT6FXi47a4oE78fnBxavmBYognGu YYLh+Viw1bZPTFrktJywuxfGsNsS9XPXPzR629SOhlovftZM/TJRkbc0ZGjHW4Ibi+f4 dF7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:content-disposition:mime-version :mail-followup-to:message-id:subject:cc:to:from:date; bh=gHCSOiOQ/3BoSnevwUQJi+hekb9wt6ArxhyG7h5IeQ8=; fh=pyUFLYuGmbk2SWKGf9x0Nq1LA87ZJo/+KUWwgltBVoY=; b=KQk4n9DT8409YCB8xzOSCT3dAe/5qAgwjbNzStsVecnYb6d2qDWK71W4xv95A/nEt8 rLEd17ToWFOuOuLvQYI7GTbK2pJeXKGT3et0JHvrY1MfcIX6+djdjsPIBuxelWqBOpOG XeJ0isMrXzJV+S49uXs6+9H1KrtXLx6z/oWSjSGYWfaSgiu14DX1aouAlmJBhI/GtqRI 75jsafUA9XDPn5i35J3Bper/LEmYDYK0Q2IvRbN18H5KIkNKr20Jm/srF3Tj+71gDd33 Fj4V5tsI2lZ7SrlOpRyilAW+gh4pc20/sMEyHkoXjwePV51Cps4ojCLNADwzeeUCud0y Ev/Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t23-20020a635357000000b005574c3ac68dsi2663934pgl.493.2023.06.24.21.15.40; Sat, 24 Jun 2023 21:15:51 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230506AbjFYDfH (ORCPT + 99 others); Sat, 24 Jun 2023 23:35:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229674AbjFYDfF (ORCPT ); Sat, 24 Jun 2023 23:35:05 -0400 Received: from mx6.didiglobal.com (mx6.didiglobal.com [111.202.70.123]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 7120DB5 for ; Sat, 24 Jun 2023 20:35:03 -0700 (PDT) Received: from mail.didiglobal.com (unknown [10.79.65.12]) by mx6.didiglobal.com (Maildata Gateway V2.8) with ESMTPS id 0F18A11002112F; Sun, 25 Jun 2023 11:35:01 +0800 (CST) Received: from didi-ThinkCentre-M930t-N000 (10.79.64.101) by ZJY02-ACTMBX-02.didichuxing.com (10.79.65.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Sun, 25 Jun 2023 11:35:00 +0800 Date: Sun, 25 Jun 2023 11:34:52 +0800 X-MD-Sfrom: tiozhang@didiglobal.com X-MD-SrcIP: 10.79.65.12 From: tiozhang To: CC: , , , , , , , , , , Subject: [PATCH] cred: convert printks to pr_ Message-ID: <20230625033452.GA22858@didi-ThinkCentre-M930t-N000> Mail-Followup-To: joe@perches.com, akpm@linux-foundation.org, gregkh@linuxfoundation.org, keescook@chromium.org, mcgrof@kernel.org, senozhatsky@chromium.org, pc@cjr.nz, linux-kernel@vger.kernel.org, zyhtheonly@gmail.com, zyhtheonly@yeah.net, zwp10758@gmail.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [10.79.64.101] X-ClientProxiedBy: ZJY01-PUBMBX-01.didichuxing.com (10.79.64.32) To ZJY02-ACTMBX-02.didichuxing.com (10.79.65.12) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 Use current logging style. Signed-off-by: tiozhang --- kernel/cred.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/kernel/cred.c b/kernel/cred.c index e10c15f51c1f..918409af008b 100644 --- a/kernel/cred.c +++ b/kernel/cred.c @@ -4,6 +4,9 @@ * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowells@redhat.com) */ + +#define pr_fmt(fmt) "CRED: " fmt + #include #include #include @@ -836,32 +839,32 @@ EXPORT_SYMBOL(creds_are_invalid); static void dump_invalid_creds(const struct cred *cred, const char *label, const struct task_struct *tsk) { - printk(KERN_ERR "CRED: %s credentials: %p %s%s%s\n", + pr_err("%s credentials: %p %s%s%s\n", label, cred, cred == &init_cred ? "[init]" : "", cred == tsk->real_cred ? "[real]" : "", cred == tsk->cred ? "[eff]" : ""); - printk(KERN_ERR "CRED: ->magic=%x, put_addr=%p\n", + pr_err("->magic=%x, put_addr=%p\n", cred->magic, cred->put_addr); - printk(KERN_ERR "CRED: ->usage=%d, subscr=%d\n", + pr_err("->usage=%d, subscr=%d\n", atomic_read(&cred->usage), read_cred_subscribers(cred)); - printk(KERN_ERR "CRED: ->*uid = { %d,%d,%d,%d }\n", + pr_err("->*uid = { %d,%d,%d,%d }\n", from_kuid_munged(&init_user_ns, cred->uid), from_kuid_munged(&init_user_ns, cred->euid), from_kuid_munged(&init_user_ns, cred->suid), from_kuid_munged(&init_user_ns, cred->fsuid)); - printk(KERN_ERR "CRED: ->*gid = { %d,%d,%d,%d }\n", + pr_err("->*gid = { %d,%d,%d,%d }\n", from_kgid_munged(&init_user_ns, cred->gid), from_kgid_munged(&init_user_ns, cred->egid), from_kgid_munged(&init_user_ns, cred->sgid), from_kgid_munged(&init_user_ns, cred->fsgid)); #ifdef CONFIG_SECURITY - printk(KERN_ERR "CRED: ->security is %p\n", cred->security); + pr_err("->security is %p\n", cred->security); if ((unsigned long) cred->security >= PAGE_SIZE && (((unsigned long) cred->security & 0xffffff00) != (POISON_FREE << 24 | POISON_FREE << 16 | POISON_FREE << 8))) - printk(KERN_ERR "CRED: ->security {%x, %x}\n", + pr_err("->security {%x, %x}\n", ((u32*)cred->security)[0], ((u32*)cred->security)[1]); #endif @@ -872,8 +875,8 @@ static void dump_invalid_creds(const struct cred *cred, const char *label, */ void __noreturn __invalid_creds(const struct cred *cred, const char *file, unsigned line) { - printk(KERN_ERR "CRED: Invalid credentials\n"); - printk(KERN_ERR "CRED: At %s:%u\n", file, line); + pr_err("Invalid credentials\n"); + pr_err("At %s:%u\n", file, line); dump_invalid_creds(cred, "Specified", current); BUG(); } @@ -899,14 +902,14 @@ void __validate_process_creds(struct task_struct *tsk, return; invalid_creds: - printk(KERN_ERR "CRED: Invalid process credentials\n"); - printk(KERN_ERR "CRED: At %s:%u\n", file, line); + pr_err("Invalid process credentials\n"); + pr_err("At %s:%u\n", file, line); dump_invalid_creds(tsk->real_cred, "Real", tsk); if (tsk->cred != tsk->real_cred) dump_invalid_creds(tsk->cred, "Effective", tsk); else - printk(KERN_ERR "CRED: Effective creds == Real creds\n"); + pr_err("Effective creds == Real creds\n"); BUG(); } EXPORT_SYMBOL(__validate_process_creds); -- 2.17.1