NTFS3 file system kernel mode driver
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: "Alexandro Calò" <alexandro.calo@nozominetworks.com>,
	"almaz.alexandrovich@paragon-software.com"
	<almaz.alexandrovich@paragon-software.com>
Cc: oe-kbuild-all@lists.linux.dev,
	"ntfs3@lists.linux.dev" <ntfs3@lists.linux.dev>
Subject: Re: [PATCH] fs/ntfs3: Fix OOB write if ret == buf_len in ntfs_utf16_to_nls()
Date: Wed, 8 Jul 2026 16:15:43 +0800	[thread overview]
Message-ID: <202607081615.v0kQjQMH-lkp@intel.com> (raw)
In-Reply-To: <3EFE7695-DA5B-4A28-8E39-4853BBA784FC@nozominetworks.com>

Hi Alexandro,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 0e35b9b6ec0ffcc5e23cbdec09f5c622ad532b53]

url:    https://github.com/intel-lab-lkp/linux/commits/Alexandro-Cal/fs-ntfs3-Fix-OOB-write-if-ret-buf_len-in-ntfs_utf16_to_nls/20260708-001557
base:   0e35b9b6ec0ffcc5e23cbdec09f5c622ad532b53
patch link:    https://lore.kernel.org/r/3EFE7695-DA5B-4A28-8E39-4853BBA784FC%40nozominetworks.com
patch subject: [PATCH] fs/ntfs3: Fix OOB write if ret == buf_len in ntfs_utf16_to_nls()
config: x86_64-randconfig-161 (https://download.01.org/0day-ci/archive/20260708/202607081615.v0kQjQMH-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch: v0.5.0-9185-gbcc58b9c

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/202607081615.v0kQjQMH-lkp@intel.com/

smatch warnings:
fs/ntfs3/dir.c:32 ntfs_utf16_to_nls() warn: inconsistent indenting

vim +32 fs/ntfs3/dir.c

    17	
    18	/* Convert little endian UTF-16 to NLS string. */
    19	int ntfs_utf16_to_nls(struct ntfs_sb_info *sbi, const __le16 *name, u32 len,
    20			      u8 *buf, int buf_len)
    21	{
    22		int ret, warn;
    23		u8 *op;
    24		struct nls_table *nls = sbi->options->nls;
    25	
    26		static_assert(sizeof(wchar_t) == sizeof(__le16));
    27	
    28		if (!nls) {
    29			/* UTF-16 -> UTF-8 */
    30			ret = utf16s_to_utf8s((wchar_t *)name, len, UTF16_LITTLE_ENDIAN,
    31					      buf, buf_len);
  > 32	        if (ret >= buf_len) {
    33	            ret = buf_len-1;
    34	        }
    35			buf[ret] = '\0';
    36			return ret;
    37		}
    38	
    39		op = buf;
    40		warn = 0;
    41	
    42		while (len--) {
    43			u16 ec;
    44			int charlen;
    45			char dump[5];
    46	
    47			if (buf_len < NLS_MAX_CHARSET_SIZE) {
    48				ntfs_warn(sbi->sb,
    49					  "filename was truncated while converting.");
    50				break;
    51			}
    52	
    53			ec = le16_to_cpu(*name++);
    54			charlen = nls->uni2char(ec, op, buf_len);
    55	
    56			if (charlen > 0) {
    57				op += charlen;
    58				buf_len -= charlen;
    59				continue;
    60			}
    61	
    62			*op++ = '_';
    63			buf_len -= 1;
    64			if (warn)
    65				continue;
    66	
    67			warn = 1;
    68			hex_byte_pack(&dump[0], ec >> 8);
    69			hex_byte_pack(&dump[2], ec);
    70			dump[4] = 0;
    71	
    72			ntfs_err(sbi->sb, "failed to convert \"%s\" to %s", dump,
    73				 nls->charset);
    74		}
    75	
    76		*op = '\0';
    77		return op - buf;
    78	}
    79	

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

      reply	other threads:[~2026-07-08  8:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-07 15:49 [PATCH] fs/ntfs3: Fix OOB write if ret == buf_len in ntfs_utf16_to_nls() Alexandro Calò
2026-07-08  8:15 ` kernel test robot [this message]

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=202607081615.v0kQjQMH-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=alexandro.calo@nozominetworks.com \
    --cc=almaz.alexandrovich@paragon-software.com \
    --cc=ntfs3@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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