+ mm-zswap-change-incorrect-strncmp-use-to-strcmp.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: mm/zswap: change incorrect strncmp use to strcmp
has been added to the -mm tree.  Its filename is
     mm-zswap-change-incorrect-strncmp-use-to-strcmp.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/mm-zswap-change-incorrect-strncmp-use-to-strcmp.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/mm-zswap-change-incorrect-strncmp-use-to-strcmp.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Dan Streetman <ddstreet@xxxxxxxx>
Subject: mm/zswap: change incorrect strncmp use to strcmp

Change the use of strncmp in zswap_pool_find_get() to strcmp.

The use of strncmp is no longer correct, now that zswap_zpool_type is not
an array; sizeof() will return the size of a pointer, which isn't the
right length to compare.  We don't need to use strncmp anyway, because the
existing params and the passed in params are all guaranteed to be null
terminated, so strcmp should be used.

Signed-off-by: Dan Streetman <ddstreet@xxxxxxxx>
Reported-by: Weijie Yang <weijie.yang@xxxxxxxxxxx>
Cc: Seth Jennings <sjennings@xxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/zswap.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff -puN mm/zswap.c~mm-zswap-change-incorrect-strncmp-use-to-strcmp mm/zswap.c
--- a/mm/zswap.c~mm-zswap-change-incorrect-strncmp-use-to-strcmp
+++ a/mm/zswap.c
@@ -541,6 +541,7 @@ static struct zswap_pool *zswap_pool_las
 	return last;
 }
 
+/* type and compressor must be null-terminated */
 static struct zswap_pool *zswap_pool_find_get(char *type, char *compressor)
 {
 	struct zswap_pool *pool;
@@ -548,10 +549,9 @@ static struct zswap_pool *zswap_pool_fin
 	assert_spin_locked(&zswap_pools_lock);
 
 	list_for_each_entry_rcu(pool, &zswap_pools, list) {
-		if (strncmp(pool->tfm_name, compressor, sizeof(pool->tfm_name)))
+		if (strcmp(pool->tfm_name, compressor))
 			continue;
-		if (strncmp(zpool_get_type(pool->zpool), type,
-			    sizeof(zswap_zpool_type)))
+		if (strcmp(zpool_get_type(pool->zpool), type))
 			continue;
 		/* if we can't get it, it's about to be destroyed */
 		if (!zswap_pool_get(pool))
_

Patches currently in -mm which might be from ddstreet@xxxxxxxx are

mm-zswap-change-incorrect-strncmp-use-to-strcmp.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux