@@ -271,14 +271,14 @@ static struct file_system_type *__get_fs_type(const char *name, int len)
struct file_system_type *get_fs_type(const char *name)
{
struct file_system_type *fs;
- const char *dot = strchr(name, '.');
- int len = dot ? dot - name : strlen(name);
+ const char *dot = strchrnul(name, '.');
+ int len = dot - name;
fs = __get_fs_type(name, len);
if (!fs && (request_module("fs-%.*s", len, name) == 0))
fs = __get_fs_type(name, len);
- if (dot && fs && !(fs->fs_flags & FS_HAS_SUBTYPE)) {
+ if (*dot && fs && !(fs->fs_flags & FS_HAS_SUBTYPE)) {
put_filesystem(fs);
fs = NULL;
}
Using strchrnul yields smaller code and avoids extra strlen call. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> --- fs/filesystems.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)