kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] CacheFiles: delete unused code in cachefiles_cook_key()
@ 2015-02-01 20:50 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2015-02-01 20:50 UTC (permalink / raw)
  To: kernel-janitors

This code was presumably left over from previuos unpublished versions.

We set "len" twice to 0 and then to 5 a couple lines below.  We set
"seg" to 250 or 252, then check if it is less than zero (it isn't) so
I have deleted all the "seg" related code.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/fs/cachefiles/key.c b/fs/cachefiles/key.c
index 33b58c6..a163723 100644
--- a/fs/cachefiles/key.c
+++ b/fs/cachefiles/key.c
@@ -39,7 +39,7 @@ char *cachefiles_cook_key(const u8 *raw, int keylen, uint8_t type)
 	unsigned char csum, ch;
 	unsigned int acc;
 	char *key;
-	int loop, len, max, seg, mark, print;
+	int loop, len, max, mark, print;
 
 	_enter(",%d", keylen);
 
@@ -82,8 +82,6 @@ char *cachefiles_cook_key(const u8 *raw, int keylen, uint8_t type)
 	if (!key)
 		return NULL;
 
-	len = 0;
-
 	/* build the cooked key */
 	sprintf(key, "@%02x%c+", (unsigned) csum, 0);
 	len = 5;
@@ -98,15 +96,7 @@ char *cachefiles_cook_key(const u8 *raw, int keylen, uint8_t type)
 		key[len] = cachefiles_charmap[acc & 63];
 		len += 2;
 
-		seg = 250;
 		for (loop = keylen; loop > 0; loop--) {
-			if (seg <= 0) {
-				key[len++] = '\0';
-				mark = len;
-				key[len++] = '+';
-				seg = 252;
-			}
-
 			key[len++] = *raw++;
 			ASSERT(len < max);
 		}
@@ -117,15 +107,7 @@ char *cachefiles_cook_key(const u8 *raw, int keylen, uint8_t type)
 		default:				type = 'S';	break;
 		}
 	} else {
-		seg = 252;
 		for (loop = keylen; loop > 0; loop--) {
-			if (seg <= 0) {
-				key[len++] = '\0';
-				mark = len;
-				key[len++] = '+';
-				seg = 252;
-			}
-
 			acc = *raw++;
 			acc |= *raw++ << 8;
 			acc |= *raw++ << 16;

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-02-01 20:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-01 20:50 [patch] CacheFiles: delete unused code in cachefiles_cook_key() Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).