Skip to contentSkip to conversation

fsck.minix: remove unnecessary memset calls

PATCH New Francesco Cosoleto 2 participants 5 messages Nov 8, 2011 – Nov 9, 2011 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fsck.minix: remove unnecessary memset calls

The program aborts without using this unintialized allocated memory, setting to zero doesn't look needed.

memset calls with sizeof() of pointer as argument (reported by clang).

---
 disk-utils/fsck.minix.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
disk-utils/fsck.minix.c +0 -2
index eb02f9e..90c9200 100644
@@ -611,8 +611,6 @@ read_tables(void) {
 	zone_map = malloc(zmaps * MINIX_BLOCK_SIZE);
 	if (!inode_map)
 		die(_("Unable to allocate buffer for zone map"));
-	memset(inode_map,0,sizeof(inode_map));
-	memset(zone_map,0,sizeof(zone_map));
 	inode_buffer = malloc(buffsz);
 	if (!inode_buffer)
 		die(_("Unable to allocate buffer for inodes"));
Signature · 1 line
1.7.3.4
#1 lore raw

PATCH 1/1 libblkid: silence a format string warning

Fix the following clang warning:

exfat.c:130:41: warning: conversion specifies type 'unsigned short' but the argument has type 'uint8_t' (aka 'unsigned char') [-Wformat]

         blkid_probe_sprintf_version(pr, "%hu.%hu",
                                              ~~^
                                              %c
---
 libblkid/src/superblocks/exfat.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
libblkid/src/superblocks/exfat.c +1 -1
index bada3a8..215c671 100644
@@ -127,7 +127,7 @@ static int probe_exfat(blkid_probe pr, const struct blkid_idmag *mag)
 			sb->volume_serial[3], sb->volume_serial[2],
 			sb->volume_serial[1], sb->volume_serial[0]);
 
-	blkid_probe_sprintf_version(pr, "%hu.%hu",
+	blkid_probe_sprintf_version(pr, "%u.%u",
 			sb->version.major, sb->version.minor);
 
 	return 0;
Signature · 1 line
1.7.3.4
#2 lore raw

PATCH 1/1 whereis: remove unused value warning

In reply to Francesco Cosoleto
---
 misc-utils/whereis.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
misc-utils/whereis.c +1 -1
index 9f74963..925cc93 100644
@@ -268,7 +268,7 @@ static void fillpath(void)
 		return;
 	pathcp = xstrdup(path);
 
-	for (tmp = pathcp; ;tmp = NULL, tok) {
+	for (tmp = pathcp; ; tmp = NULL) {
 		tok = strtok_r(tmp, ":", &key);
 		if (!tok)
 			break;
Signature · 1 line
1.7.3.4
#3 lore raw

PATCH 1/1 whereis: silence comparison between signed/unsigned warning

In reply to Francesco Cosoleto
---
 misc-utils/whereis.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
misc-utils/whereis.c +1 -1
index 03ea95e..d776b32 100644
@@ -241,7 +241,7 @@ findin(char *dir, char *cp)
 
 static int inpath(const char *str)
 {
-	int i;
+	size_t i;
 
 	for (i = 0; i < ARRAY_SIZE(bindirs) - 1 ; i++)
 		if (!strcmp(bindirs[i], str))
Signature · 1 line
1.7.3.4
maintainer
#4 lore raw

Re: [PATCH] whereis: silence comparison between signed/unsigned warning

All your patches applied, except this one.

Quoted 10 lines · Francesco Cosoleto
---
 misc-utils/whereis.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
misc-utils/whereis.c +0 -0
index 03ea95e..d776b32 100644

misc-utils/whereis.c findin(char *dir, char *cp) · line 244

Quoted 5 lines
misc-utils/whereis.c +1 -1
@@ -241,7 +241,7 @@ findin(char *dir, char *cp)
 
 static int inpath(const char *str)
 {
-	int i;
+	size_t i;

It seems that your git tree is not up to date, this problem has been already fixed:

 $ git blame -L244,+1 misc-utils/whereis.c
 cc69f339 (Karel Zak 2011-08-31 11:58:01 +0200 244)      size_t i;

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com