From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D22DC2BB1D for ; Thu, 12 Mar 2020 13:28:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 440EF206BE for ; Thu, 12 Mar 2020 13:28:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727354AbgCLN21 (ORCPT ); Thu, 12 Mar 2020 09:28:27 -0400 Received: from mga05.intel.com ([192.55.52.43]:11090 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726558AbgCLN21 (ORCPT ); Thu, 12 Mar 2020 09:28:27 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Mar 2020 06:28:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,545,1574150400"; d="scan'208";a="277798906" Received: from lkp-server01.sh.intel.com (HELO lkp-server01) ([10.239.97.150]) by fmsmga002.fm.intel.com with ESMTP; 12 Mar 2020 06:28:25 -0700 Received: from kbuild by lkp-server01 with local (Exim 4.89) (envelope-from ) id 1jCNsu-000Cx1-O9; Thu, 12 Mar 2020 21:28:24 +0800 Date: Thu, 12 Mar 2020 21:28:11 +0800 From: kbuild test robot To: Frank van der Linden Cc: kbuild-all@lists.01.org, bfields@fieldses.org, chuck.lever@oracle.com, linux-nfs@vger.kernel.org Subject: Re: [PATCH 11/14] nfsd: add user xattr RPC XDR encoding/decoding logic Message-ID: <202003122103.Fb2JQy2Z%lkp@intel.com> References: <20200311195954.27117-12-fllinden@amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200311195954.27117-12-fllinden@amazon.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Hi Frank, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on nfsd/nfsd-next] [also build test WARNING on nfs/linux-next linus/master v5.6-rc5 next-20200312] [cannot apply to cel/for-next] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Frank-van-der-Linden/server-side-user-xattr-support-RFC-8276/20200312-064928 base: git://linux-nfs.org/~bfields/linux.git nfsd-next reproduce: # apt-get install sparse # sparse version: v0.6.1-174-g094d5a94-dirty make ARCH=x86_64 allmodconfig make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' If you fix the issue, kindly add following tag Reported-by: kbuild test robot sparse warnings: (new ones prefixed by >>) fs/nfsd/nfs4xdr.c:1860:16: sparse: sparse: incorrect type in assignment (different base types) @@ expected int status @@ got restricted __int status @@ fs/nfsd/nfs4xdr.c:1860:16: sparse: expected int status fs/nfsd/nfs4xdr.c:1860:16: sparse: got restricted __be32 fs/nfsd/nfs4xdr.c:1862:24: sparse: sparse: incorrect type in return expression (different base types) @@ expected restricted __be32 @@ got be32 @@ fs/nfsd/nfs4xdr.c:1862:24: sparse: expected restricted __be32 fs/nfsd/nfs4xdr.c:1862:24: sparse: got int status >> fs/nfsd/nfs4xdr.c:1913:24: sparse: sparse: incorrect type in return expression (different base types) @@ expected int @@ got restricted __be32 [usertypint @@ >> fs/nfsd/nfs4xdr.c:1913:24: sparse: expected int >> fs/nfsd/nfs4xdr.c:1913:24: sparse: got restricted __be32 [usertype] fs/nfsd/nfs4xdr.c:1949:24: sparse: sparse: incorrect type in return expression (different base types) @@ expected int @@ got restricted __be32 [usertypint @@ fs/nfsd/nfs4xdr.c:1949:24: sparse: expected int fs/nfsd/nfs4xdr.c:1949:24: sparse: got restricted __be32 [usertype] fs/nfsd/nfs4xdr.c:1958:24: sparse: sparse: incorrect type in return expression (different base types) @@ expected int @@ got restricted __be32 [usertypint @@ fs/nfsd/nfs4xdr.c:1958:24: sparse: expected int fs/nfsd/nfs4xdr.c:1958:24: sparse: got restricted __be32 [usertype] >> fs/nfsd/nfs4xdr.c:1979:9: sparse: sparse: incorrect type in return expression (different base types) @@ expected int @@ got restricted __be32 [assigned] [usertypint @@ fs/nfsd/nfs4xdr.c:1979:9: sparse: expected int >> fs/nfsd/nfs4xdr.c:1979:9: sparse: got restricted __be32 [assigned] [usertype] status >> fs/nfsd/nfs4xdr.c:1997:24: sparse: sparse: incorrect type in return expression (different base types) @@ expected restricted __be32 @@ got stricted __be32 @@ fs/nfsd/nfs4xdr.c:1997:24: sparse: expected restricted __be32 >> fs/nfsd/nfs4xdr.c:1997:24: sparse: got int [assigned] status >> fs/nfsd/nfs4xdr.c:2004:24: sparse: sparse: incorrect type in assignment (different base types) @@ expected int [assigned] status @@ got restricted __bint [assigned] status @@ >> fs/nfsd/nfs4xdr.c:2004:24: sparse: expected int [assigned] status fs/nfsd/nfs4xdr.c:2004:24: sparse: got restricted __be32 [usertype] fs/nfsd/nfs4xdr.c:2007:16: sparse: sparse: incorrect type in return expression (different base types) @@ expected restricted __be32 @@ got stricted __be32 @@ fs/nfsd/nfs4xdr.c:2007:16: sparse: expected restricted __be32 fs/nfsd/nfs4xdr.c:2007:16: sparse: got int [assigned] status >> fs/nfsd/nfs4xdr.c:2026:16: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be32 [usertype] status @@ got e] status @@ >> fs/nfsd/nfs4xdr.c:2026:16: sparse: expected restricted __be32 [usertype] status >> fs/nfsd/nfs4xdr.c:2026:16: sparse: got int >> fs/nfsd/nfs4xdr.c:2044:24: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be32 [assigned] [usertype] status @@ got e] status @@ >> fs/nfsd/nfs4xdr.c:2044:24: sparse: expected restricted __be32 [assigned] [usertype] status fs/nfsd/nfs4xdr.c:2044:24: sparse: got int >> fs/nfsd/nfs4xdr.c:2097:39: sparse: sparse: incorrect type in return expression (different base types) @@ expected restricted __be32 @@ got e32 @@ fs/nfsd/nfs4xdr.c:2097:39: sparse: expected restricted __be32 fs/nfsd/nfs4xdr.c:2097:39: sparse: got int fs/nfsd/nfs4xdr.c:4698:24: sparse: sparse: incorrect type in return expression (different base types) @@ expected int @@ got restricted __be32 [usertypint @@ fs/nfsd/nfs4xdr.c:4698:24: sparse: expected int fs/nfsd/nfs4xdr.c:4698:24: sparse: got restricted __be32 [usertype] fs/nfsd/nfs4xdr.c:4708:32: sparse: sparse: incorrect type in return expression (different base types) @@ expected int @@ got restricted __be32 [usertypint @@ fs/nfsd/nfs4xdr.c:4708:32: sparse: expected int fs/nfsd/nfs4xdr.c:4708:32: sparse: got restricted __be32 [usertype] fs/nfsd/nfs4xdr.c:4745:36: sparse: sparse: incorrect type in return expression (different base types) @@ expected restricted __be32 @@ got e32 @@ fs/nfsd/nfs4xdr.c:4745:36: sparse: expected restricted __be32 fs/nfsd/nfs4xdr.c:4745:36: sparse: got int fs/nfsd/nfs4xdr.c:4780:24: sparse: sparse: incorrect type in return expression (different base types) @@ expected int @@ got restricted __be32 [usertypint @@ fs/nfsd/nfs4xdr.c:4780:24: sparse: expected int fs/nfsd/nfs4xdr.c:4780:24: sparse: got restricted __be32 [usertype] fs/nfsd/nfs4xdr.c:4784:24: sparse: sparse: incorrect type in return expression (different base types) @@ expected int @@ got restricted __be32 [usertypint @@ fs/nfsd/nfs4xdr.c:4784:24: sparse: expected int fs/nfsd/nfs4xdr.c:4784:24: sparse: got restricted __be32 [usertype] fs/nfsd/nfs4xdr.c:4808:24: sparse: sparse: incorrect type in return expression (different base types) @@ expected restricted __be32 @@ got stricted __be32 @@ fs/nfsd/nfs4xdr.c:4808:24: sparse: expected restricted __be32 fs/nfsd/nfs4xdr.c:4808:24: sparse: got int [assigned] status >> fs/nfsd/nfs4xdr.c:4884:15: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [assigned] [usertype] count @@ got ed int [assigned] [usertype] count @@ >> fs/nfsd/nfs4xdr.c:4884:15: sparse: expected unsigned int [assigned] [usertype] count fs/nfsd/nfs4xdr.c:4884:15: sparse: got restricted __be32 [usertype] vim +1913 fs/nfsd/nfs4xdr.c 1881 1882 /* 1883 * XDR data that is more than PAGE_SIZE in size is normally part of a 1884 * read or write. However, the size of extended attributes is limited 1885 * by the maximum request size, and then further limited by the underlying 1886 * filesystem limits. This can exceed PAGE_SIZE (currently, XATTR_SIZE_MAX 1887 * is 64k). Since there is no kvec- or page-based interface to xattrs, 1888 * and we're not dealing with contiguous pages, we need to do some copying. 1889 */ 1890 1891 /* 1892 * Decode int to buffer. Uses head and pages constructed by 1893 * svcxdr_construct_vector. 1894 */ 1895 static int 1896 nfsd4_vbuf_from_stream(struct nfsd4_compoundargs *argp, struct kvec *head, 1897 struct page **pages, char **bufp, u32 buflen) 1898 { 1899 char *tmp, *dp; 1900 u32 len; 1901 1902 if (buflen <= head->iov_len) { 1903 /* 1904 * We're in luck, the head has enough space. Just return 1905 * the head, no need for copying. 1906 */ 1907 *bufp = head->iov_base; 1908 return 0; 1909 } 1910 1911 tmp = svcxdr_tmpalloc(argp, buflen); 1912 if (tmp == NULL) > 1913 return nfserr_jukebox; 1914 1915 dp = tmp; 1916 memcpy(dp, head->iov_base, head->iov_len); 1917 buflen -= head->iov_len; 1918 dp += head->iov_len; 1919 1920 while (buflen > 0) { 1921 len = min_t(u32, buflen, PAGE_SIZE); 1922 memcpy(dp, page_address(*pages), len); 1923 1924 buflen -= len; 1925 dp += len; 1926 pages++; 1927 } 1928 1929 *bufp = tmp; 1930 return 0; 1931 } 1932 1933 /* 1934 * Get a user extended attribute name from the XDR buffer. 1935 * It will not have the "user." prefix, so prepend it. 1936 * Lastly, check for nul characters in the name. 1937 */ 1938 static int 1939 nfsd4_decode_xattr_name(struct nfsd4_compoundargs *argp, char **namep) 1940 { 1941 DECODE_HEAD; 1942 char *name, *sp, *dp; 1943 u32 namelen, cnt; 1944 1945 READ_BUF(4); 1946 namelen = be32_to_cpup(p++); 1947 1948 if (namelen > (XATTR_NAME_MAX - XATTR_USER_PREFIX_LEN)) 1949 return nfserr_nametoolong; 1950 1951 if (namelen == 0) 1952 goto xdr_error; 1953 1954 READ_BUF(namelen); 1955 1956 name = svcxdr_tmpalloc(argp, namelen + XATTR_USER_PREFIX_LEN + 1); 1957 if (!name) 1958 return nfserr_jukebox; 1959 1960 memcpy(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN); 1961 1962 /* 1963 * Copy the extended attribute name over while checking for 0 1964 * characters. 1965 */ 1966 sp = (char *)p; 1967 dp = name + XATTR_USER_PREFIX_LEN; 1968 cnt = namelen; 1969 1970 while (cnt-- > 0) { 1971 if (*sp == '\0') 1972 goto xdr_error; 1973 *dp++ = *sp++; 1974 } 1975 *dp = '\0'; 1976 1977 *namep = name; 1978 > 1979 DECODE_TAIL; 1980 } 1981 1982 /* 1983 * A GETXATTR op request comes without a length specifier. We just set the 1984 * maximum length for the reply based on XATTR_SIZE_MAX and the maximum 1985 * channel reply size, allocate a buffer of that length and pass it to 1986 * vfs_getxattr. 1987 */ 1988 static __be32 1989 nfsd4_decode_getxattr(struct nfsd4_compoundargs *argp, 1990 struct nfsd4_getxattr *getxattr) 1991 { 1992 int status; 1993 u32 maxcount; 1994 1995 status = nfsd4_decode_xattr_name(argp, &getxattr->getxa_name); 1996 if (status) > 1997 return status; 1998 1999 maxcount = svc_max_payload(argp->rqstp); 2000 maxcount = min_t(u32, XATTR_SIZE_MAX, maxcount); 2001 2002 getxattr->getxa_buf = svcxdr_tmpalloc(argp, maxcount); 2003 if (!getxattr->getxa_buf) > 2004 status = nfserr_jukebox; 2005 getxattr->getxa_len = maxcount; 2006 2007 return status; 2008 } 2009 2010 static __be32 2011 nfsd4_decode_setxattr(struct nfsd4_compoundargs *argp, 2012 struct nfsd4_setxattr *setxattr) 2013 { 2014 DECODE_HEAD; 2015 u32 flags, maxcount, size; 2016 struct kvec head; 2017 struct page **pagelist; 2018 2019 READ_BUF(4); 2020 flags = be32_to_cpup(p++); 2021 2022 if (flags > SETXATTR4_REPLACE) 2023 return nfserr_inval; 2024 setxattr->setxa_flags = flags; 2025 > 2026 status = nfsd4_decode_xattr_name(argp, &setxattr->setxa_name); 2027 if (status) 2028 return status; 2029 2030 maxcount = svc_max_payload(argp->rqstp); 2031 maxcount = min_t(u32, XATTR_SIZE_MAX, maxcount); 2032 2033 READ_BUF(4); 2034 size = be32_to_cpup(p++); 2035 if (size > maxcount) 2036 return nfserr_xattr2big; 2037 2038 setxattr->setxa_len = size; 2039 if (size > 0) { 2040 status = svcxdr_construct_vector(argp, &head, &pagelist, size); 2041 if (status) 2042 return status; 2043 > 2044 status = nfsd4_vbuf_from_stream(argp, &head, pagelist, 2045 &setxattr->setxa_buf, size); 2046 } 2047 2048 DECODE_TAIL; 2049 } 2050 2051 static __be32 2052 nfsd4_decode_listxattrs(struct nfsd4_compoundargs *argp, 2053 struct nfsd4_listxattrs *listxattrs) 2054 { 2055 DECODE_HEAD; 2056 u32 maxcount; 2057 2058 READ_BUF(12); 2059 p = xdr_decode_hyper(p, &listxattrs->lsxa_cookie); 2060 2061 /* 2062 * If the cookie is too large to have even one user.x attribute 2063 * plus trailing '\0' left in a maximum size buffer, it's invalid. 2064 */ 2065 if (listxattrs->lsxa_cookie >= 2066 (XATTR_LIST_MAX / (XATTR_USER_PREFIX_LEN + 2))) 2067 return nfserr_badcookie; 2068 2069 maxcount = be32_to_cpup(p++); 2070 if (maxcount < 8) 2071 /* Always need at least 2 words (length and one character) */ 2072 return nfserr_inval; 2073 2074 maxcount = min(maxcount, svc_max_payload(argp->rqstp)); 2075 listxattrs->lsxa_maxcount = maxcount; 2076 2077 /* 2078 * Unfortunately, there is no interface to only list xattrs for 2079 * one prefix. So there is no good way to convert maxcount to 2080 * a maximum value to pass to vfs_listxattr, as we don't know 2081 * how many of the returned attributes will be user attributes. 2082 * 2083 * So, always ask vfs_listxattr for the maximum size, and encode 2084 * as many as possible. 2085 */ 2086 listxattrs->lsxa_buf = svcxdr_tmpalloc(argp, XATTR_LIST_MAX); 2087 if (!listxattrs->lsxa_buf) 2088 status = nfserr_jukebox; 2089 2090 DECODE_TAIL; 2091 } 2092 2093 static __be32 2094 nfsd4_decode_removexattr(struct nfsd4_compoundargs *argp, 2095 struct nfsd4_removexattr *removexattr) 2096 { > 2097 return nfsd4_decode_xattr_name(argp, &removexattr->rmxa_name); 2098 } 2099 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============4104771568382724036==" MIME-Version: 1.0 From: kbuild test robot To: kbuild-all@lists.01.org Subject: Re: [PATCH 11/14] nfsd: add user xattr RPC XDR encoding/decoding logic Date: Thu, 12 Mar 2020 21:28:11 +0800 Message-ID: <202003122103.Fb2JQy2Z%lkp@intel.com> In-Reply-To: <20200311195954.27117-12-fllinden@amazon.com> List-Id: --===============4104771568382724036== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Frank, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on nfsd/nfsd-next] [also build test WARNING on nfs/linux-next linus/master v5.6-rc5 next-20200= 312] [cannot apply to cel/for-next] [if your patch is applied to the wrong git tree, please drop us a note to h= elp improve the system. BTW, we also suggest to use '--base' option to specify = the base tree in git format-patch, please see https://stackoverflow.com/a/37406= 982] url: https://github.com/0day-ci/linux/commits/Frank-van-der-Linden/serve= r-side-user-xattr-support-RFC-8276/20200312-064928 base: git://linux-nfs.org/~bfields/linux.git nfsd-next reproduce: # apt-get install sparse # sparse version: v0.6.1-174-g094d5a94-dirty make ARCH=3Dx86_64 allmodconfig make C=3D1 CF=3D'-fdiagnostic-prefix -D__CHECK_ENDIAN__' If you fix the issue, kindly add following tag Reported-by: kbuild test robot sparse warnings: (new ones prefixed by >>) fs/nfsd/nfs4xdr.c:1860:16: sparse: sparse: incorrect type in assignment = (different base types) @@ expected int status @@ got restricted __int= status @@ fs/nfsd/nfs4xdr.c:1860:16: sparse: expected int status fs/nfsd/nfs4xdr.c:1860:16: sparse: got restricted __be32 fs/nfsd/nfs4xdr.c:1862:24: sparse: sparse: incorrect type in return expr= ession (different base types) @@ expected restricted __be32 @@ got be= 32 @@ fs/nfsd/nfs4xdr.c:1862:24: sparse: expected restricted __be32 fs/nfsd/nfs4xdr.c:1862:24: sparse: got int status >> fs/nfsd/nfs4xdr.c:1913:24: sparse: sparse: incorrect type in return expr= ession (different base types) @@ expected int @@ got restricted __be3= 2 [usertypint @@ >> fs/nfsd/nfs4xdr.c:1913:24: sparse: expected int >> fs/nfsd/nfs4xdr.c:1913:24: sparse: got restricted __be32 [usertype] fs/nfsd/nfs4xdr.c:1949:24: sparse: sparse: incorrect type in return expr= ession (different base types) @@ expected int @@ got restricted __be3= 2 [usertypint @@ fs/nfsd/nfs4xdr.c:1949:24: sparse: expected int fs/nfsd/nfs4xdr.c:1949:24: sparse: got restricted __be32 [usertype] fs/nfsd/nfs4xdr.c:1958:24: sparse: sparse: incorrect type in return expr= ession (different base types) @@ expected int @@ got restricted __be3= 2 [usertypint @@ fs/nfsd/nfs4xdr.c:1958:24: sparse: expected int fs/nfsd/nfs4xdr.c:1958:24: sparse: got restricted __be32 [usertype] >> fs/nfsd/nfs4xdr.c:1979:9: sparse: sparse: incorrect type in return expre= ssion (different base types) @@ expected int @@ got restricted __be32= [assigned] [usertypint @@ fs/nfsd/nfs4xdr.c:1979:9: sparse: expected int >> fs/nfsd/nfs4xdr.c:1979:9: sparse: got restricted __be32 [assigned] [u= sertype] status >> fs/nfsd/nfs4xdr.c:1997:24: sparse: sparse: incorrect type in return expr= ession (different base types) @@ expected restricted __be32 @@ got st= ricted __be32 @@ fs/nfsd/nfs4xdr.c:1997:24: sparse: expected restricted __be32 >> fs/nfsd/nfs4xdr.c:1997:24: sparse: got int [assigned] status >> fs/nfsd/nfs4xdr.c:2004:24: sparse: sparse: incorrect type in assignment = (different base types) @@ expected int [assigned] status @@ got restr= icted __bint [assigned] status @@ >> fs/nfsd/nfs4xdr.c:2004:24: sparse: expected int [assigned] status fs/nfsd/nfs4xdr.c:2004:24: sparse: got restricted __be32 [usertype] fs/nfsd/nfs4xdr.c:2007:16: sparse: sparse: incorrect type in return expr= ession (different base types) @@ expected restricted __be32 @@ got st= ricted __be32 @@ fs/nfsd/nfs4xdr.c:2007:16: sparse: expected restricted __be32 fs/nfsd/nfs4xdr.c:2007:16: sparse: got int [assigned] status >> fs/nfsd/nfs4xdr.c:2026:16: sparse: sparse: incorrect type in assignment = (different base types) @@ expected restricted __be32 [usertype] status @= @ got e] status @@ >> fs/nfsd/nfs4xdr.c:2026:16: sparse: expected restricted __be32 [userty= pe] status >> fs/nfsd/nfs4xdr.c:2026:16: sparse: got int >> fs/nfsd/nfs4xdr.c:2044:24: sparse: sparse: incorrect type in assignment = (different base types) @@ expected restricted __be32 [assigned] [usertyp= e] status @@ got e] status @@ >> fs/nfsd/nfs4xdr.c:2044:24: sparse: expected restricted __be32 [assign= ed] [usertype] status fs/nfsd/nfs4xdr.c:2044:24: sparse: got int >> fs/nfsd/nfs4xdr.c:2097:39: sparse: sparse: incorrect type in return expr= ession (different base types) @@ expected restricted __be32 @@ got e3= 2 @@ fs/nfsd/nfs4xdr.c:2097:39: sparse: expected restricted __be32 fs/nfsd/nfs4xdr.c:2097:39: sparse: got int fs/nfsd/nfs4xdr.c:4698:24: sparse: sparse: incorrect type in return expr= ession (different base types) @@ expected int @@ got restricted __be3= 2 [usertypint @@ fs/nfsd/nfs4xdr.c:4698:24: sparse: expected int fs/nfsd/nfs4xdr.c:4698:24: sparse: got restricted __be32 [usertype] fs/nfsd/nfs4xdr.c:4708:32: sparse: sparse: incorrect type in return expr= ession (different base types) @@ expected int @@ got restricted __be3= 2 [usertypint @@ fs/nfsd/nfs4xdr.c:4708:32: sparse: expected int fs/nfsd/nfs4xdr.c:4708:32: sparse: got restricted __be32 [usertype] fs/nfsd/nfs4xdr.c:4745:36: sparse: sparse: incorrect type in return expr= ession (different base types) @@ expected restricted __be32 @@ got e3= 2 @@ fs/nfsd/nfs4xdr.c:4745:36: sparse: expected restricted __be32 fs/nfsd/nfs4xdr.c:4745:36: sparse: got int fs/nfsd/nfs4xdr.c:4780:24: sparse: sparse: incorrect type in return expr= ession (different base types) @@ expected int @@ got restricted __be3= 2 [usertypint @@ fs/nfsd/nfs4xdr.c:4780:24: sparse: expected int fs/nfsd/nfs4xdr.c:4780:24: sparse: got restricted __be32 [usertype] fs/nfsd/nfs4xdr.c:4784:24: sparse: sparse: incorrect type in return expr= ession (different base types) @@ expected int @@ got restricted __be3= 2 [usertypint @@ fs/nfsd/nfs4xdr.c:4784:24: sparse: expected int fs/nfsd/nfs4xdr.c:4784:24: sparse: got restricted __be32 [usertype] fs/nfsd/nfs4xdr.c:4808:24: sparse: sparse: incorrect type in return expr= ession (different base types) @@ expected restricted __be32 @@ got st= ricted __be32 @@ fs/nfsd/nfs4xdr.c:4808:24: sparse: expected restricted __be32 fs/nfsd/nfs4xdr.c:4808:24: sparse: got int [assigned] status >> fs/nfsd/nfs4xdr.c:4884:15: sparse: sparse: incorrect type in assignment = (different base types) @@ expected unsigned int [assigned] [usertype] co= unt @@ got ed int [assigned] [usertype] count @@ >> fs/nfsd/nfs4xdr.c:4884:15: sparse: expected unsigned int [assigned] [= usertype] count fs/nfsd/nfs4xdr.c:4884:15: sparse: got restricted __be32 [usertype] vim +1913 fs/nfsd/nfs4xdr.c 1881 = 1882 /* 1883 * XDR data that is more than PAGE_SIZE in size is normally part of a 1884 * read or write. However, the size of extended attributes is limited 1885 * by the maximum request size, and then further limited by the unde= rlying 1886 * filesystem limits. This can exceed PAGE_SIZE (currently, XATTR_SI= ZE_MAX 1887 * is 64k). Since there is no kvec- or page-based interface to xattr= s, 1888 * and we're not dealing with contiguous pages, we need to do some c= opying. 1889 */ 1890 = 1891 /* 1892 * Decode int to buffer. Uses head and pages constructed by 1893 * svcxdr_construct_vector. 1894 */ 1895 static int 1896 nfsd4_vbuf_from_stream(struct nfsd4_compoundargs *argp, struct kvec = *head, 1897 struct page **pages, char **bufp, u32 buflen) 1898 { 1899 char *tmp, *dp; 1900 u32 len; 1901 = 1902 if (buflen <=3D head->iov_len) { 1903 /* 1904 * We're in luck, the head has enough space. Just return 1905 * the head, no need for copying. 1906 */ 1907 *bufp =3D head->iov_base; 1908 return 0; 1909 } 1910 = 1911 tmp =3D svcxdr_tmpalloc(argp, buflen); 1912 if (tmp =3D=3D NULL) > 1913 return nfserr_jukebox; 1914 = 1915 dp =3D tmp; 1916 memcpy(dp, head->iov_base, head->iov_len); 1917 buflen -=3D head->iov_len; 1918 dp +=3D head->iov_len; 1919 = 1920 while (buflen > 0) { 1921 len =3D min_t(u32, buflen, PAGE_SIZE); 1922 memcpy(dp, page_address(*pages), len); 1923 = 1924 buflen -=3D len; 1925 dp +=3D len; 1926 pages++; 1927 } 1928 = 1929 *bufp =3D tmp; 1930 return 0; 1931 } 1932 = 1933 /* 1934 * Get a user extended attribute name from the XDR buffer. 1935 * It will not have the "user." prefix, so prepend it. 1936 * Lastly, check for nul characters in the name. 1937 */ 1938 static int 1939 nfsd4_decode_xattr_name(struct nfsd4_compoundargs *argp, char **name= p) 1940 { 1941 DECODE_HEAD; 1942 char *name, *sp, *dp; 1943 u32 namelen, cnt; 1944 = 1945 READ_BUF(4); 1946 namelen =3D be32_to_cpup(p++); 1947 = 1948 if (namelen > (XATTR_NAME_MAX - XATTR_USER_PREFIX_LEN)) 1949 return nfserr_nametoolong; 1950 = 1951 if (namelen =3D=3D 0) 1952 goto xdr_error; 1953 = 1954 READ_BUF(namelen); 1955 = 1956 name =3D svcxdr_tmpalloc(argp, namelen + XATTR_USER_PREFIX_LEN + 1); 1957 if (!name) 1958 return nfserr_jukebox; 1959 = 1960 memcpy(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN); 1961 = 1962 /* 1963 * Copy the extended attribute name over while checking for 0 1964 * characters. 1965 */ 1966 sp =3D (char *)p; 1967 dp =3D name + XATTR_USER_PREFIX_LEN; 1968 cnt =3D namelen; 1969 = 1970 while (cnt-- > 0) { 1971 if (*sp =3D=3D '\0') 1972 goto xdr_error; 1973 *dp++ =3D *sp++; 1974 } 1975 *dp =3D '\0'; 1976 = 1977 *namep =3D name; 1978 = > 1979 DECODE_TAIL; 1980 } 1981 = 1982 /* 1983 * A GETXATTR op request comes without a length specifier. We just s= et the 1984 * maximum length for the reply based on XATTR_SIZE_MAX and the maxi= mum 1985 * channel reply size, allocate a buffer of that length and pass it = to 1986 * vfs_getxattr. 1987 */ 1988 static __be32 1989 nfsd4_decode_getxattr(struct nfsd4_compoundargs *argp, 1990 struct nfsd4_getxattr *getxattr) 1991 { 1992 int status; 1993 u32 maxcount; 1994 = 1995 status =3D nfsd4_decode_xattr_name(argp, &getxattr->getxa_name); 1996 if (status) > 1997 return status; 1998 = 1999 maxcount =3D svc_max_payload(argp->rqstp); 2000 maxcount =3D min_t(u32, XATTR_SIZE_MAX, maxcount); 2001 = 2002 getxattr->getxa_buf =3D svcxdr_tmpalloc(argp, maxcount); 2003 if (!getxattr->getxa_buf) > 2004 status =3D nfserr_jukebox; 2005 getxattr->getxa_len =3D maxcount; 2006 = 2007 return status; 2008 } 2009 = 2010 static __be32 2011 nfsd4_decode_setxattr(struct nfsd4_compoundargs *argp, 2012 struct nfsd4_setxattr *setxattr) 2013 { 2014 DECODE_HEAD; 2015 u32 flags, maxcount, size; 2016 struct kvec head; 2017 struct page **pagelist; 2018 = 2019 READ_BUF(4); 2020 flags =3D be32_to_cpup(p++); 2021 = 2022 if (flags > SETXATTR4_REPLACE) 2023 return nfserr_inval; 2024 setxattr->setxa_flags =3D flags; 2025 = > 2026 status =3D nfsd4_decode_xattr_name(argp, &setxattr->setxa_name); 2027 if (status) 2028 return status; 2029 = 2030 maxcount =3D svc_max_payload(argp->rqstp); 2031 maxcount =3D min_t(u32, XATTR_SIZE_MAX, maxcount); 2032 = 2033 READ_BUF(4); 2034 size =3D be32_to_cpup(p++); 2035 if (size > maxcount) 2036 return nfserr_xattr2big; 2037 = 2038 setxattr->setxa_len =3D size; 2039 if (size > 0) { 2040 status =3D svcxdr_construct_vector(argp, &head, &pagelist, size); 2041 if (status) 2042 return status; 2043 = > 2044 status =3D nfsd4_vbuf_from_stream(argp, &head, pagelist, 2045 &setxattr->setxa_buf, size); 2046 } 2047 = 2048 DECODE_TAIL; 2049 } 2050 = 2051 static __be32 2052 nfsd4_decode_listxattrs(struct nfsd4_compoundargs *argp, 2053 struct nfsd4_listxattrs *listxattrs) 2054 { 2055 DECODE_HEAD; 2056 u32 maxcount; 2057 = 2058 READ_BUF(12); 2059 p =3D xdr_decode_hyper(p, &listxattrs->lsxa_cookie); 2060 = 2061 /* 2062 * If the cookie is too large to have even one user.x attribute 2063 * plus trailing '\0' left in a maximum size buffer, it's invalid. 2064 */ 2065 if (listxattrs->lsxa_cookie >=3D 2066 (XATTR_LIST_MAX / (XATTR_USER_PREFIX_LEN + 2))) 2067 return nfserr_badcookie; 2068 = 2069 maxcount =3D be32_to_cpup(p++); 2070 if (maxcount < 8) 2071 /* Always need@least 2 words (length and one character) */ 2072 return nfserr_inval; 2073 = 2074 maxcount =3D min(maxcount, svc_max_payload(argp->rqstp)); 2075 listxattrs->lsxa_maxcount =3D maxcount; 2076 = 2077 /* 2078 * Unfortunately, there is no interface to only list xattrs for 2079 * one prefix. So there is no good way to convert maxcount to 2080 * a maximum value to pass to vfs_listxattr, as we don't know 2081 * how many of the returned attributes will be user attributes. 2082 * 2083 * So, always ask vfs_listxattr for the maximum size, and encode 2084 * as many as possible. 2085 */ 2086 listxattrs->lsxa_buf =3D svcxdr_tmpalloc(argp, XATTR_LIST_MAX); 2087 if (!listxattrs->lsxa_buf) 2088 status =3D nfserr_jukebox; 2089 = 2090 DECODE_TAIL; 2091 } 2092 = 2093 static __be32 2094 nfsd4_decode_removexattr(struct nfsd4_compoundargs *argp, 2095 struct nfsd4_removexattr *removexattr) 2096 { > 2097 return nfsd4_decode_xattr_name(argp, &removexattr->rmxa_name); 2098 } 2099 = --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org --===============4104771568382724036==--