From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932241AbcE2MMG (ORCPT ); Sun, 29 May 2016 08:12:06 -0400 Received: from science.sciencehorizons.net ([71.41.210.147]:16658 "HELO ns.sciencehorizons.net" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with SMTP id S932137AbcE2MME (ORCPT ); Sun, 29 May 2016 08:12:04 -0400 Date: 29 May 2016 08:12:03 -0400 Message-ID: <20160529121203.2279.qmail@ns.sciencehorizons.net> From: "George Spelvin" To: geert@linux-m68k.org, linux@sciencehorizons.net Subject: [PATCH] fs/namei.c. If we way we want zero-length string support, mean it Cc: linux-kernel@vger.kernel.org, linux@roeck-us.net, torvalds@linux-foundation.org In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >>From 4b237fc0c5addf58ef0e0bbd3740d64007c36375 Mon Sep 17 00:00:00 2001 From: George Spelvin Date: Sun, 29 May 2016 08:05:56 -0400 Subject: [PATCH] fs/namei.c. If we way we want zero-length string suppor mean it. hash_name() is not changed for speed, but the more general purpose hashlen_string need to support zero-length strings. Signed-off-by: George Spelvin Fixes: fcfd2fbf22d2587196890103d41e3d554c47da0e --- Just kill me. I didn't re-test the side of the code that I "didn't touch", but at Bruce Field's (correct!) prompting, I changed the test to cover a corner case it hadn't addressed. fs/namei.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index aefba699..dcb85255 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1958,11 +1958,11 @@ u64 hashlen_string(const char *name) unsigned long len = 0, c; c = (unsigned char)*name; - do { + while (c) { len++; hash = partial_name_hash(c, hash); c = (unsigned char)name[len]; - } while (c); + } return hashlen_create(end_name_hash(hash), len); } EXPORT_SYMBOL(hashlen_string); -- 2.8.1