lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Sun, 9 Aug 2020 16:08:59 +0800
From:   kernel test robot <lkp@...el.com>
To:     Damien Le Moal <damien.lemoal@....com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Dave Chinner <dchinner@...hat.com>
Subject: fs/zonefs/super.c:1110:6: warning: Variable 'ret' is reassigned a
 value before the old one has been used.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   06a81c1c7db9bd5de0bd38cd5acc44bb22b99150
commit: 8dcc1a9d90c10fa4143e5c17821082e5e60e46a1 fs: New zonefs file system
date:   6 months ago
compiler: alpha-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>


cppcheck warnings: (new ones prefixed by >>)

>> fs/zonefs/super.c:1110:6: warning: Variable 'ret' is reassigned a value before the old one has been used. [redundantAssignment]
    ret = 0;
        ^
   fs/zonefs/super.c:1045:0: note: Variable 'ret' is reassigned a value before the old one has been used.
    int ret = -ENOMEM;
   ^
   fs/zonefs/super.c:1110:6: note: Variable 'ret' is reassigned a value before the old one has been used.
    ret = 0;
        ^
   fs/zonefs/super.c:1257:6: warning: Variable 'ret' is reassigned a value before the old one has been used. [redundantAssignment]
    ret = 0;
        ^
   fs/zonefs/super.c:1210:6: note: Variable 'ret' is reassigned a value before the old one has been used.
    ret = -EINVAL;
        ^
   fs/zonefs/super.c:1257:6: note: Variable 'ret' is reassigned a value before the old one has been used.
    ret = 0;
        ^

vim +/ret +1110 fs/zonefs/super.c

  1031	
  1032	/*
  1033	 * Create a zone group and populate it with zone files.
  1034	 */
  1035	static int zonefs_create_zgroup(struct zonefs_zone_data *zd,
  1036					enum zonefs_ztype type)
  1037	{
  1038		struct super_block *sb = zd->sb;
  1039		struct zonefs_sb_info *sbi = ZONEFS_SB(sb);
  1040		struct blk_zone *zone, *next, *end;
  1041		const char *zgroup_name;
  1042		char *file_name;
  1043		struct dentry *dir;
  1044		unsigned int n = 0;
  1045		int ret = -ENOMEM;
  1046	
  1047		/* If the group is empty, there is nothing to do */
  1048		if (!zd->nr_zones[type])
  1049			return 0;
  1050	
  1051		file_name = kmalloc(ZONEFS_NAME_MAX, GFP_KERNEL);
  1052		if (!file_name)
  1053			return -ENOMEM;
  1054	
  1055		if (type == ZONEFS_ZTYPE_CNV)
  1056			zgroup_name = "cnv";
  1057		else
  1058			zgroup_name = "seq";
  1059	
  1060		dir = zonefs_create_inode(sb->s_root, zgroup_name, NULL, type);
  1061		if (!dir)
  1062			goto free;
  1063	
  1064		/*
  1065		 * The first zone contains the super block: skip it.
  1066		 */
  1067		end = zd->zones + blkdev_nr_zones(sb->s_bdev->bd_disk);
  1068		for (zone = &zd->zones[1]; zone < end; zone = next) {
  1069	
  1070			next = zone + 1;
  1071			if (zonefs_zone_type(zone) != type)
  1072				continue;
  1073	
  1074			/*
  1075			 * For conventional zones, contiguous zones can be aggregated
  1076			 * together to form larger files. Note that this overwrites the
  1077			 * length of the first zone of the set of contiguous zones
  1078			 * aggregated together. If one offline or read-only zone is
  1079			 * found, assume that all zones aggregated have the same
  1080			 * condition.
  1081			 */
  1082			if (type == ZONEFS_ZTYPE_CNV &&
  1083			    (sbi->s_features & ZONEFS_F_AGGRCNV)) {
  1084				for (; next < end; next++) {
  1085					if (zonefs_zone_type(next) != type)
  1086						break;
  1087					zone->len += next->len;
  1088					if (next->cond == BLK_ZONE_COND_READONLY &&
  1089					    zone->cond != BLK_ZONE_COND_OFFLINE)
  1090						zone->cond = BLK_ZONE_COND_READONLY;
  1091					else if (next->cond == BLK_ZONE_COND_OFFLINE)
  1092						zone->cond = BLK_ZONE_COND_OFFLINE;
  1093				}
  1094			}
  1095	
  1096			/*
  1097			 * Use the file number within its group as file name.
  1098			 */
  1099			snprintf(file_name, ZONEFS_NAME_MAX - 1, "%u", n);
  1100			if (!zonefs_create_inode(dir, file_name, zone, type))
  1101				goto free;
  1102	
  1103			n++;
  1104		}
  1105	
  1106		zonefs_info(sb, "Zone group \"%s\" has %u file%s\n",
  1107			    zgroup_name, n, n > 1 ? "s" : "");
  1108	
  1109		sbi->s_nr_files[type] = n;
> 1110		ret = 0;
  1111	
  1112	free:
  1113		kfree(file_name);
  1114	
  1115		return ret;
  1116	}
  1117	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Powered by blists - more mailing lists