Messages in this thread | | | Date | Tue, 26 Jun 2018 10:39:59 -0400 | From | Steven Rostedt <> | Subject | Re: [PATCH] printk: remove unnecessary kmalloc() from syslog during clear |
| |
On Tue, 26 Jun 2018 14:43:32 +0200 Petr Mladek <pmladek@suse.com> wrote:
> On Mon 2018-06-25 23:44:07, Sergey Senozhatsky wrote: > > On (06/25/18 10:37), Steven Rostedt wrote: > > > > > > Is IMHO rather ugly. > > > > Either way works for me. So I'll leave it to you and Petr to decide :) > > > > > And the original patch has one more advantage. If buf and clear are > > > both NULL/zero, we don't take any locks. > > > > But we never use syslog_print_all(buf = NULL, clear = false). It's either > > NULL/true [move forward clear idx, do not copy to user], or !NULL/use defined > > value [copy to user, move or don't move clear idx forward] > > Yup, I suggest the following version as a compromise. It has the code > duplication but I agree that it is negligible. Otherwise, it looks > cleaner. >
This looks fine. For proper history though, what I do in this case, would be to make this into two patches. One with Namit's original patch, and then a second that removes the code duplication (your patch).
-- Steve
| |