Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp627273imm; Thu, 13 Sep 2018 05:26:50 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZMqyD8/I4j0CBI3WZk59zMFa75IYUxmODtI5ibF+KTJUWxoEdLrIOZhDlcxGuKuIu7R9pB X-Received: by 2002:a17:902:1745:: with SMTP id i63-v6mr7068309pli.3.1536841610419; Thu, 13 Sep 2018 05:26:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536841610; cv=none; d=google.com; s=arc-20160816; b=ewfloA/YTU1LPOa4WPDDQJDgG1k6ii7hptLfIvaYTBi65UeVQWwV+T9nJrIGe3WIKz 7IK77ybkhwe9KCrqAtqlyV8rdIYBSKn7/FlJpSVCDn1RGUkIDxyrGvto9GI9XFnrJL7X aaVPVXeAZ+WibUABvOIz6BhZ1fNTW1m7LGUe2eokb+sTSF/V21hT8Ps0TiHC9wkT6K7n TRPzE6K8A3qaD3Hem5++m4v6XJIQiSLyqNWjxEYJsLh9x8Ptz8k8Oeb/RqIH8IJJO7KX 7rgjI15iKYajPldcXqiykRaTp1acVi0IySzB9wjwGDFbIsJnSuKw0C0UvHa/aO0NKgRq OvaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=RCQGUmJiZVHZlzHBVswAPmALVxMHoNx1pO3Dqg/AMcc=; b=A82hSZsfWHh9Da1nSZlKRhcOcojFx62m0wwlji2YjzIUKk/tw2/fX1ME7CDoclPBOF uFXpjXVMMaJhXvVhbhv5+IH0htCLgpDrZ4tB9IRKrb2h5AMFA1hsDKVQwmns8ZtasNi4 waRMTmAx3md4eicvMyqZacry0zCclro8e5GfxaLyS4mp6pWownL1WMNWsrRn0yVX0u9h q68olwSO5fUVYxefD7mbDKAXSOdhtDmXsAGF7pRrvkqfpxbvaQH/eIC2R7QIWJHr76K9 G/kAeRmq8Yfi5l8dNMpsU4WUcYFJ5YdBmZYbZQF7N9rDDhXkp/SN8lseQI0CBZ8g2cvM A29g== 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 m8-v6si4020328pll.102.2018.09.13.05.26.34; Thu, 13 Sep 2018 05:26:50 -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 S1727600AbeIMRfo (ORCPT + 99 others); Thu, 13 Sep 2018 13:35:44 -0400 Received: from mx2.suse.de ([195.135.220.15]:54658 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726919AbeIMRfn (ORCPT ); Thu, 13 Sep 2018 13:35:43 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 64F45B03A; Thu, 13 Sep 2018 12:26:27 +0000 (UTC) Date: Thu, 13 Sep 2018 14:26:25 +0200 From: Petr Mladek To: Sergey Senozhatsky Cc: Steven Rostedt , Alexander Potapenko , Sergey Senozhatsky , Dmitriy Vyukov , penguin-kernel@i-love.sakura.ne.jp, kbuild test robot , syzkaller , LKML , Linus Torvalds , Andrew Morton Subject: Re: [PATCH] printk: inject caller information into the body of message Message-ID: <20180913122625.6ieyexpcmlc5z2it@pathway.suse.cz> References: <20180620090413.GA444@jagdpanzerIV> <20180620091541.GB444@jagdpanzerIV> <20180620110759.GD444@jagdpanzerIV> <20180620130628.GA1000@tigerII.localdomain> <20180912065307.GA606@jagdpanzerIV> <20180912120548.4280f04a@vmware.local.home> <20180913071204.GA604@jagdpanzerIV> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180913071204.GA604@jagdpanzerIV> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 2018-09-13 16:12:54, Sergey Senozhatsky wrote: > On (09/12/18 12:05), Steven Rostedt wrote: > > > : Introduce a few helper functions for it: > > > : > > > : init_line_buffer(&buf); > > > : print_line(&buf, fmt, args); > > > : vprint_line(&buf, fmt, vararg); > > > : finish_line(&buf); > > > : > > > --- a/lib/seq_buf.c > +++ b/lib/seq_buf.c > @@ -324,3 +324,49 @@ int seq_buf_to_user(struct seq_buf *s, char __user *ubuf, int cnt) > s->readpos += cnt; > return cnt; > } > + > +int vpr_line(struct pr_line *pl, const char *fmt, va_list args) > +{ > + struct seq_buf *s = &pl->sb; > + int ret, len; > + > + if (fmt[0] == '\n') { > + pr_line_flush(pl); > + return 0; > + } You would need to check if fmt[1] == '\0'. But then you would need to be careful about a possible buffer overflow. I would personally avoid this optimization. > + ret = seq_buf_vprintf(s, fmt, args); > + > + len = seq_buf_used(s); > + if (len && s->buffer[len - 1] == '\n') > + pr_line_flush(pl); This would cause that pr_line_flush() won't be strictly needed. Also it would encourage people to use this feature a more complicated way (for more lines). Do we really want this? In general, I like this approach more than any attemps to handle continuous lines transpatently. The other attemps were much more complicated or were not reliable. Best Regards, Petr