linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Ronnie Sahlberg <lsahlber@redhat.com>,
	linux-cifs <linux-cifs@vger.kernel.org>
Cc: kbuild-all@lists.01.org, Steve French <smfrench@gmail.com>
Subject: Re: [PATCH] cifs: improve fallocate emulation
Date: Thu, 8 Apr 2021 18:36:24 +0800	[thread overview]
Message-ID: <202104081836.3bhK3xQm-lkp@intel.com> (raw)
In-Reply-To: <20210408074630.622927-1-lsahlber@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 4641 bytes --]

Hi Ronnie,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on cifs/for-next]
[also build test WARNING on v5.12-rc6 next-20210407]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Ronnie-Sahlberg/cifs-improve-fallocate-emulation/20210408-154812
base:   git://git.samba.org/sfrench/cifs-2.6.git for-next
config: x86_64-randconfig-s032-20210408 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-279-g6d5d9b42-dirty
        # https://github.com/0day-ci/linux/commit/4e8489f4555efd3340016e422828e29ae87d7f0b
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Ronnie-Sahlberg/cifs-improve-fallocate-emulation/20210408-154812
        git checkout 4e8489f4555efd3340016e422828e29ae87d7f0b
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64 

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


sparse warnings: (new ones prefixed by >>)
>> fs/cifs/smb2ops.c:3639:35: sparse: sparse: restricted __le64 degrades to integer
   fs/cifs/smb2ops.c:3645:37: sparse: sparse: restricted __le64 degrades to integer
>> fs/cifs/smb2ops.c:3662:19: sparse: sparse: incorrect type in assignment (different base types) @@     expected long long [assigned] [usertype] l @@     got restricted __le64 [usertype] length @@
   fs/cifs/smb2ops.c:3662:19: sparse:     expected long long [assigned] [usertype] l
   fs/cifs/smb2ops.c:3662:19: sparse:     got restricted __le64 [usertype] length

vim +3639 fs/cifs/smb2ops.c

  3589	
  3590	static int smb3_simple_fallocate_range(unsigned int xid,
  3591					       struct cifs_tcon *tcon,
  3592					       struct cifsFileInfo *cfile,
  3593					       loff_t off, loff_t len)
  3594	{
  3595		struct file_allocated_range_buffer in_data, *out_data = NULL, *tmp_data;
  3596		u32 out_data_len;
  3597		char *buf = NULL;
  3598		loff_t l;
  3599		int rc;
  3600	
  3601		in_data.file_offset = cpu_to_le64(off);
  3602		in_data.length = cpu_to_le64(len);
  3603		rc = SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid,
  3604				cfile->fid.volatile_fid,
  3605				FSCTL_QUERY_ALLOCATED_RANGES, true,
  3606				(char *)&in_data, sizeof(in_data),
  3607				1024 * sizeof(struct file_allocated_range_buffer),
  3608				(char **)&out_data, &out_data_len);
  3609		if (rc)
  3610			goto out;
  3611		/*
  3612		 * It is already all allocated
  3613		 */
  3614		if (out_data_len == 0)
  3615			goto out;
  3616	
  3617		buf = kzalloc(1024 * 1024, GFP_KERNEL);
  3618		if (buf == NULL) {
  3619			rc = -ENOMEM;
  3620			goto out;
  3621		}
  3622	  
  3623		tmp_data = out_data;
  3624		while (len) {
  3625			/*
  3626			 * The rest of the region is unmapped so write it all.
  3627			 */
  3628			if (out_data_len == 0) {
  3629				rc = smb3_simple_fallocate_write_range(xid, tcon,
  3630						       cfile, off, len, buf);
  3631				goto out;
  3632			}
  3633			
  3634			if (out_data_len < sizeof(struct file_allocated_range_buffer)) {
  3635				rc = -EINVAL;
  3636				goto out;
  3637			}
  3638	
> 3639			if (off < tmp_data->file_offset) {
  3640				/*
  3641				 * We are at a hole. Write until the end of the region
  3642				 * or until the next allocated data,
  3643				 * whichever comes next.
  3644				 */
  3645				l = tmp_data->file_offset - off;
  3646				if (len < l)
  3647					l = len;
  3648				rc = smb3_simple_fallocate_write_range(xid, tcon,
  3649						       cfile, off, l, buf);
  3650				if (rc)
  3651					goto out;
  3652				off = off + l;
  3653				len = len - l;
  3654				if (len == 0)
  3655					goto out;
  3656			}
  3657			/*
  3658			 * We are at a section of allocated data, just skip forward
  3659			 * until the end of the data or the end of the region
  3660			 * we are supposed to fallocate, whichever comes first.
  3661			 */
> 3662			l = tmp_data->length;
  3663			if (len < l)
  3664				l = len;
  3665			off += l;
  3666			len -= l;
  3667			
  3668			tmp_data = &tmp_data[1];
  3669			out_data_len -= sizeof(struct file_allocated_range_buffer);
  3670		}
  3671		
  3672	 out:
  3673		kfree(out_data);
  3674		kfree(buf);
  3675		return rc;
  3676	}
  3677	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 34191 bytes --]

  reply	other threads:[~2021-04-08 10:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-08  7:46 [PATCH] cifs: improve fallocate emulation Ronnie Sahlberg
2021-04-08 10:36 ` kernel test robot [this message]
2021-04-08 22:40 Ronnie Sahlberg
2021-04-09  3:55 ` Steve French
     [not found] <20210603053101.1229297-1-lsahlber@redhat.com>
2021-06-03  5:31 ` Ronnie Sahlberg
2021-06-05 20:59   ` Steve French

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=202104081836.3bhK3xQm-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=lsahlber@redhat.com \
    --cc=smfrench@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).