All of lore.kernel.org
 help / color / mirror / Atom feed
From: <gregkh@linuxfoundation.org>
To: arnd@arndb.de, computersforpeace@gmail.com,
	gregkh@linuxfoundation.org, marek.vasut@gmail.com
Cc: <stable@vger.kernel.org>, <stable-commits@vger.kernel.org>
Subject: Patch "mtd: pmcmsp: use kstrndup instead of kmalloc+strncpy" has been added to the 4.4-stable tree
Date: Wed, 15 Mar 2017 15:25:08 +0800	[thread overview]
Message-ID: <148956270810725@kroah.com> (raw)


This is a note to let you know that I've just added the patch titled

    mtd: pmcmsp: use kstrndup instead of kmalloc+strncpy

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mtd-pmcmsp-use-kstrndup-instead-of-kmalloc-strncpy.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From 906b268477bc03daaa04f739844c120fe4dbc991 Mon Sep 17 00:00:00 2001
From: Arnd Bergmann <arnd@arndb.de>
Date: Fri, 3 Feb 2017 10:49:17 +0100
Subject: mtd: pmcmsp: use kstrndup instead of kmalloc+strncpy

From: Arnd Bergmann <arnd@arndb.de>

commit 906b268477bc03daaa04f739844c120fe4dbc991 upstream.

kernelci.org reports a warning for this driver, as it copies a local
variable into a 'const char *' string:

    drivers/mtd/maps/pmcmsp-flash.c:149:30: warning: passing argument 1 of 'strncpy' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]

Using kstrndup() simplifies the code and avoids the warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/mtd/maps/pmcmsp-flash.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- a/drivers/mtd/maps/pmcmsp-flash.c
+++ b/drivers/mtd/maps/pmcmsp-flash.c
@@ -139,15 +139,13 @@ static int __init init_msp_flash(void)
 		}
 
 		msp_maps[i].bankwidth = 1;
-		msp_maps[i].name = kmalloc(7, GFP_KERNEL);
+		msp_maps[i].name = kstrndup(flash_name, 7, GFP_KERNEL);
 		if (!msp_maps[i].name) {
 			iounmap(msp_maps[i].virt);
 			kfree(msp_parts[i]);
 			goto cleanup_loop;
 		}
 
-		msp_maps[i].name = strncpy(msp_maps[i].name, flash_name, 7);
-
 		for (j = 0; j < pcnt; j++) {
 			part_name[5] = '0' + i;
 			part_name[7] = '0' + j;


Patches currently in stable-queue which might be from arnd@arndb.de are

queue-4.4/mips-ip27-disable-qlge-driver-in-defconfig.patch
queue-4.4/mips-update-ip27_defconfig-for-scsi_dh-change.patch
queue-4.4/mtd-pmcmsp-use-kstrndup-instead-of-kmalloc-strncpy.patch
queue-4.4/cpmac-remove-hopeless-warning.patch
queue-4.4/mm-memcontrol-avoid-unused-function-warning.patch
queue-4.4/mips-ip22-fix-ip28-build-for-modern-gcc.patch
queue-4.4/mips-update-lemote2f_defconfig-for-cpu_freq_stat-change.patch
queue-4.4/crypto-improve-gcc-optimization-flags-for-serpent-and-wp512.patch
queue-4.4/mips-ralink-remove-unused-rt-_wdt_reset-functions.patch
queue-4.4/mips-ralink-remove-unused-timer-functions.patch
queue-4.4/mips-update-defconfigs-for-nf_ct_proto_dccp-udplite-change.patch

                 reply	other threads:[~2017-03-15  7:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=148956270810725@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=arnd@arndb.de \
    --cc=computersforpeace@gmail.com \
    --cc=marek.vasut@gmail.com \
    --cc=stable-commits@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.