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 X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BC94C433E0 for ; Sat, 27 Jun 2020 07:10:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD20B20707 for ; Sat, 27 Jun 2020 07:10:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726032AbgF0HKh (ORCPT ); Sat, 27 Jun 2020 03:10:37 -0400 Received: from verein.lst.de ([213.95.11.211]:53843 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725885AbgF0HKh (ORCPT ); Sat, 27 Jun 2020 03:10:37 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 2364368B02; Sat, 27 Jun 2020 09:10:33 +0200 (CEST) Date: Sat, 27 Jun 2020 09:10:33 +0200 From: Christoph Hellwig To: Matthew Wilcox Cc: Christoph Hellwig , Al Viro , Linus Torvalds , Luis Chamberlain , Kees Cook , Iurii Zaikin , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 8/9] fs: don't allow kernel reads and writes without iter ops Message-ID: <20200627071033.GC11854@lst.de> References: <20200626075836.1998185-1-hch@lst.de> <20200626075836.1998185-9-hch@lst.de> <20200626135147.GB25039@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200626135147.GB25039@casper.infradead.org> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 26, 2020 at 02:51:47PM +0100, Matthew Wilcox wrote: > On Fri, Jun 26, 2020 at 09:58:35AM +0200, Christoph Hellwig wrote: > > +static void warn_unsupported(struct file *file, const char *op) > > +{ > > + char pathname[128], *path; > > + > > + path = file_path(file, pathname, sizeof(pathname)); > > + if (IS_ERR(path)) > > + path = "(unknown)"; > > + pr_warn_ratelimited( > > + "kernel %s not supported for file %s (pid: %d comm: %.20s)\n", > > + op, path, current->pid, current->comm); > > +} > > + > > how about just: > > pr_warn_ratelimited( > "kernel %s not supported for file %pD4 (pid: %d comm: %.20s)\n", > op, file, current->pid, current->comm); Sure, we could use %pD for a few less line of code and a little less typesafety. I'm not a huge fan of these custom, unchecked format specifiers, but given that they exist we might a well use them.