From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com ([192.55.52.88]:42122 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754761AbcDNMlQ (ORCPT ); Thu, 14 Apr 2016 08:41:16 -0400 Date: Thu, 14 Apr 2016 15:41:11 +0300 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Mika Westerberg Cc: linux-gpio@vger.kernel.org, Dmitry Torokhov , Linus Walleij , Alexandre Courbot , stable@vger.kernel.org Subject: Re: [PATCH] gpiolib-acpi: Duplicate con_id string when adding it to the crs lookup list Message-ID: <20160414124111.GO4329@intel.com> References: <1460563836-1899-1-git-send-email-ville.syrjala@linux.intel.com> <20160414122749.GV1714@lahna.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20160414122749.GV1714@lahna.fi.intel.com> Sender: stable-owner@vger.kernel.org List-ID: On Thu, Apr 14, 2016 at 03:27:49PM +0300, Mika Westerberg wrote: > On Wed, Apr 13, 2016 at 07:10:36PM +0300, ville.syrjala@linux.intel.com wrote: > > diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c > > index 682070d20f00..6238ddb81709 100644 > > --- a/drivers/gpio/gpiolib-acpi.c > > +++ b/drivers/gpio/gpiolib-acpi.c > > @@ -950,7 +950,7 @@ int acpi_gpio_count(struct device *dev, const char *con_id) > > struct acpi_crs_lookup { > > struct list_head node; > > struct acpi_device *adev; > > - const char *con_id; > > + char *con_id; > > Why it cannot be left as const? I suppose it could. > > > }; > > > > static DEFINE_MUTEX(acpi_crs_lookup_lock); > > @@ -977,7 +977,7 @@ bool acpi_can_fallback_to_crs(struct acpi_device *adev, const char *con_id) > > lookup = kmalloc(sizeof(*lookup), GFP_KERNEL); > > if (lookup) { > > lookup->adev = adev; > > - lookup->con_id = con_id; > > + lookup->con_id = kstrdup(con_id, GFP_KERNEL); > > list_add_tail(&lookup->node, &acpi_crs_lookup_list); > > } > > } > > -- > > 2.7.4 -- Ville Syrj�l� Intel OTC