From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751148AbdJCHUL (ORCPT ); Tue, 3 Oct 2017 03:20:11 -0400 Received: from mx2.suse.de ([195.135.220.15]:35748 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750787AbdJCHUJ (ORCPT ); Tue, 3 Oct 2017 03:20:09 -0400 Date: Tue, 3 Oct 2017 09:20:07 +0200 From: Petr Mladek To: Sergey Senozhatsky Cc: Rob Herring , Steven Rostedt , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: Re: [PATCH] of: do not leak console options Message-ID: <20171003072007.GB9706@pathway.suse.cz> References: <20170926062510.4948-1-sergey.senozhatsky@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170926062510.4948-1-sergey.senozhatsky@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 2017-09-26 15:25:10, Sergey Senozhatsky wrote: > Do not strdup() console options. It seems that the only reason for > it to be strdup()-ed was a compilation warning: printk, UART and > console drivers, for some reason, expect char pointer instead of > const char pointer. So we can just pass `of_stdout_options', but > need to cast it to char pointer. A better fix would be to change > printk, console drivers and UART to accept const char `options'; > but that will take time - there are lots of drivers to update. > > The patch also fixes a possible memory leak: add_preferred_console() > can fail, but we don't kfree() options. > > Signed-off-by: Sergey Senozhatsky Of course, it would be better to change add_preferred_console(). But it would trigger many other changes. This alternative "temporary" change looks safe to me. Feel free to use Reviewed-by: Petr Mladek Best Regards, Petr