public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Ethan Carter Edwards <ethan@ethancedwards.com>,
	Theodore Ts'o <tytso@mit.edu>,
	Andreas Dilger <adilger.kernel@dilger.ca>
Cc: oe-kbuild-all@lists.linux.dev, linux-ext4@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org,
	Ethan Carter Edwards <ethan@ethancedwards.com>
Subject: Re: [PATCH v2] ext4: replace strcpy() with '.' assignment
Date: Mon, 19 May 2025 13:58:04 +0800	[thread overview]
Message-ID: <202505191321.ZwdQZhut-lkp@intel.com> (raw)
In-Reply-To: <20250518-ext4-strcpy-v2-1-80d316325046@ethancedwards.com>

Hi Ethan,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 5723cc3450bccf7f98f227b9723b5c9f6b3af1c5]

url:    https://github.com/intel-lab-lkp/linux/commits/Ethan-Carter-Edwards/ext4-replace-strcpy-with-assignment/20250519-115601
base:   5723cc3450bccf7f98f227b9723b5c9f6b3af1c5
patch link:    https://lore.kernel.org/r/20250518-ext4-strcpy-v2-1-80d316325046%40ethancedwards.com
patch subject: [PATCH v2] ext4: replace strcpy() with '.' assignment
config: csky-randconfig-001-20250519 (https://download.01.org/0day-ci/archive/20250519/202505191321.ZwdQZhut-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 10.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250519/202505191321.ZwdQZhut-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505191321.ZwdQZhut-lkp@intel.com/

All warnings (new ones prefixed by >>):

   fs/ext4/inline.c: In function 'ext4_inlinedir_to_tree':
>> fs/ext4/inline.c:1317:17: warning: assignment to 'char' from 'char *' makes integer from pointer without a cast [-Wint-conversion]
    1317 |    fake.name[0] = ".";
         |                 ^
   fs/ext4/inline.c:1327:32: warning: assignment to 'char' from 'char *' makes integer from pointer without a cast [-Wint-conversion]
    1327 |    fake.name[0] = fake.name[1] = ".";
         |                                ^


vim +1317 fs/ext4/inline.c

  1259	
  1260	/*
  1261	 * This function fills a red-black tree with information from an
  1262	 * inlined dir.  It returns the number directory entries loaded
  1263	 * into the tree.  If there is an error it is returned in err.
  1264	 */
  1265	int ext4_inlinedir_to_tree(struct file *dir_file,
  1266				   struct inode *dir, ext4_lblk_t block,
  1267				   struct dx_hash_info *hinfo,
  1268				   __u32 start_hash, __u32 start_minor_hash,
  1269				   int *has_inline_data)
  1270	{
  1271		int err = 0, count = 0;
  1272		unsigned int parent_ino;
  1273		int pos;
  1274		struct ext4_dir_entry_2 *de;
  1275		struct inode *inode = file_inode(dir_file);
  1276		int ret, inline_size = 0;
  1277		struct ext4_iloc iloc;
  1278		void *dir_buf = NULL;
  1279		struct ext4_dir_entry_2 fake;
  1280		struct fscrypt_str tmp_str;
  1281	
  1282		ret = ext4_get_inode_loc(inode, &iloc);
  1283		if (ret)
  1284			return ret;
  1285	
  1286		down_read(&EXT4_I(inode)->xattr_sem);
  1287		if (!ext4_has_inline_data(inode)) {
  1288			up_read(&EXT4_I(inode)->xattr_sem);
  1289			*has_inline_data = 0;
  1290			goto out;
  1291		}
  1292	
  1293		inline_size = ext4_get_inline_size(inode);
  1294		dir_buf = kmalloc(inline_size, GFP_NOFS);
  1295		if (!dir_buf) {
  1296			ret = -ENOMEM;
  1297			up_read(&EXT4_I(inode)->xattr_sem);
  1298			goto out;
  1299		}
  1300	
  1301		ret = ext4_read_inline_data(inode, dir_buf, inline_size, &iloc);
  1302		up_read(&EXT4_I(inode)->xattr_sem);
  1303		if (ret < 0)
  1304			goto out;
  1305	
  1306		pos = 0;
  1307		parent_ino = le32_to_cpu(((struct ext4_dir_entry_2 *)dir_buf)->inode);
  1308		while (pos < inline_size) {
  1309			/*
  1310			 * As inlined dir doesn't store any information about '.' and
  1311			 * only the inode number of '..' is stored, we have to handle
  1312			 * them differently.
  1313			 */
  1314			if (pos == 0) {
  1315				fake.inode = cpu_to_le32(inode->i_ino);
  1316				fake.name_len = 1;
> 1317				fake.name[0] = ".";
  1318				fake.rec_len = ext4_rec_len_to_disk(
  1319						  ext4_dir_rec_len(fake.name_len, NULL),
  1320						  inline_size);
  1321				ext4_set_de_type(inode->i_sb, &fake, S_IFDIR);
  1322				de = &fake;
  1323				pos = EXT4_INLINE_DOTDOT_OFFSET;
  1324			} else if (pos == EXT4_INLINE_DOTDOT_OFFSET) {
  1325				fake.inode = cpu_to_le32(parent_ino);
  1326				fake.name_len = 2;
  1327				fake.name[0] = fake.name[1] = ".";
  1328				fake.rec_len = ext4_rec_len_to_disk(
  1329						  ext4_dir_rec_len(fake.name_len, NULL),
  1330						  inline_size);
  1331				ext4_set_de_type(inode->i_sb, &fake, S_IFDIR);
  1332				de = &fake;
  1333				pos = EXT4_INLINE_DOTDOT_SIZE;
  1334			} else {
  1335				de = (struct ext4_dir_entry_2 *)(dir_buf + pos);
  1336				pos += ext4_rec_len_from_disk(de->rec_len, inline_size);
  1337				if (ext4_check_dir_entry(inode, dir_file, de,
  1338						 iloc.bh, dir_buf,
  1339						 inline_size, pos)) {
  1340					ret = count;
  1341					goto out;
  1342				}
  1343			}
  1344	
  1345			if (ext4_hash_in_dirent(dir)) {
  1346				hinfo->hash = EXT4_DIRENT_HASH(de);
  1347				hinfo->minor_hash = EXT4_DIRENT_MINOR_HASH(de);
  1348			} else {
  1349				err = ext4fs_dirhash(dir, de->name, de->name_len, hinfo);
  1350				if (err) {
  1351					ret = err;
  1352					goto out;
  1353				}
  1354			}
  1355			if ((hinfo->hash < start_hash) ||
  1356			    ((hinfo->hash == start_hash) &&
  1357			     (hinfo->minor_hash < start_minor_hash)))
  1358				continue;
  1359			if (de->inode == 0)
  1360				continue;
  1361			tmp_str.name = de->name;
  1362			tmp_str.len = de->name_len;
  1363			err = ext4_htree_store_dirent(dir_file, hinfo->hash,
  1364						      hinfo->minor_hash, de, &tmp_str);
  1365			if (err) {
  1366				ret = err;
  1367				goto out;
  1368			}
  1369			count++;
  1370		}
  1371		ret = count;
  1372	out:
  1373		kfree(dir_buf);
  1374		brelse(iloc.bh);
  1375		return ret;
  1376	}
  1377	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

  parent reply	other threads:[~2025-05-19  5:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-19  3:54 [PATCH v2] ext4: replace strcpy() with '.' assignment Ethan Carter Edwards
2025-05-19  5:58 ` kernel test robot
2025-05-19 13:56   ` Theodore Ts'o
2025-05-19  5:58 ` kernel test robot [this message]
2025-05-19 13:52 ` Kees Cook
2025-05-19 14:59   ` Theodore Ts'o
2025-05-23 12:31     ` David Laight
2025-05-23 14:24       ` Theodore Ts'o
2025-05-23 17:14         ` Kees Cook
2025-05-23 22:07           ` Theodore Ts'o

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202505191321.ZwdQZhut-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=ethan@ethancedwards.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox