All of lore.kernel.org
 help / color / mirror / Atom feed
* [cel:topic-rpc-with-tls 9999/9999] net/sunrpc/svcauth_unix.c:814 svcauth_tls_accept() warn: was && intended here instead of ||?
@ 2022-01-22  5:28 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-01-22  5:28 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Chuck Lever <chuck.lever@oracle.com>

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux topic-rpc-with-tls
head:   a72d5318846d67a7f3f5f2bcb4c0c09c4f8907d1
commit: a72d5318846d67a7f3f5f2bcb4c0c09c4f8907d1 [9999/9999] SUNRPC: Teach server to recognize RPC_AUTH_TLS
:::::: branch date: 8 hours ago
:::::: commit date: 8 hours ago
config: x86_64-randconfig-m001-20220117 (https://download.01.org/0day-ci/archive/20220122/202201221318.rSSI29vI-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

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

New smatch warnings:
net/sunrpc/svcauth_unix.c:814 svcauth_tls_accept() warn: was && intended here instead of ||?

Old smatch warnings:
net/sunrpc/svcauth_unix.c:721 svcauth_unix_set_client() warn: passing zero to 'PTR_ERR'
net/sunrpc/svcauth_unix.c:752 svcauth_null_accept() warn: was && intended here instead of ||?
net/sunrpc/svcauth_unix.c:898 svcauth_unix_accept() warn: was && intended here instead of ||?

vim +814 net/sunrpc/svcauth_unix.c

^1da177e4c3f41 Linus Torvalds 2005-04-16  795  
^1da177e4c3f41 Linus Torvalds 2005-04-16  796  
a72d5318846d67 Chuck Lever    2021-08-05  797  static int
a72d5318846d67 Chuck Lever    2021-08-05  798  svcauth_tls_accept(struct svc_rqst *rqstp, __be32 *authp)
a72d5318846d67 Chuck Lever    2021-08-05  799  {
a72d5318846d67 Chuck Lever    2021-08-05  800  	struct svc_cred	*cred = &rqstp->rq_cred;
a72d5318846d67 Chuck Lever    2021-08-05  801  	struct kvec *argv = rqstp->rq_arg.head;
a72d5318846d67 Chuck Lever    2021-08-05  802  	struct kvec *resv = rqstp->rq_res.head;
a72d5318846d67 Chuck Lever    2021-08-05  803  
a72d5318846d67 Chuck Lever    2021-08-05  804  	if (argv->iov_len < XDR_UNIT * 3)
a72d5318846d67 Chuck Lever    2021-08-05  805  		return SVC_GARBAGE;
a72d5318846d67 Chuck Lever    2021-08-05  806  
a72d5318846d67 Chuck Lever    2021-08-05  807  	/* Call's cred length */
a72d5318846d67 Chuck Lever    2021-08-05  808  	if (svc_getu32(argv) != xdr_zero) {
a72d5318846d67 Chuck Lever    2021-08-05  809  		*authp = rpc_autherr_badcred;
a72d5318846d67 Chuck Lever    2021-08-05  810  		return SVC_DENIED;
a72d5318846d67 Chuck Lever    2021-08-05  811  	}
a72d5318846d67 Chuck Lever    2021-08-05  812  
a72d5318846d67 Chuck Lever    2021-08-05  813  	/* Call's verifier flavor and its length */
a72d5318846d67 Chuck Lever    2021-08-05 @814  	if (svc_getu32(argv) != rpc_auth_null ||
a72d5318846d67 Chuck Lever    2021-08-05  815  	    svc_getu32(argv) != xdr_zero) {
a72d5318846d67 Chuck Lever    2021-08-05  816  		*authp = rpc_autherr_badverf;
a72d5318846d67 Chuck Lever    2021-08-05  817  		return SVC_DENIED;
a72d5318846d67 Chuck Lever    2021-08-05  818  	}
a72d5318846d67 Chuck Lever    2021-08-05  819  
a72d5318846d67 Chuck Lever    2021-08-05  820  	/* AUTH_TLS is not valid on non-NULL procedures */
a72d5318846d67 Chuck Lever    2021-08-05  821  	if (rqstp->rq_proc != 0) {
a72d5318846d67 Chuck Lever    2021-08-05  822  		*authp = rpc_autherr_badcred;
a72d5318846d67 Chuck Lever    2021-08-05  823  		return SVC_DENIED;
a72d5318846d67 Chuck Lever    2021-08-05  824  	}
a72d5318846d67 Chuck Lever    2021-08-05  825  
a72d5318846d67 Chuck Lever    2021-08-05  826  	/* Mapping to nobody uid/gid is required */
a72d5318846d67 Chuck Lever    2021-08-05  827  	cred->cr_uid = INVALID_UID;
a72d5318846d67 Chuck Lever    2021-08-05  828  	cred->cr_gid = INVALID_GID;
a72d5318846d67 Chuck Lever    2021-08-05  829  	cred->cr_group_info = groups_alloc(0);
a72d5318846d67 Chuck Lever    2021-08-05  830  	if (cred->cr_group_info == NULL)
a72d5318846d67 Chuck Lever    2021-08-05  831  		return SVC_CLOSE; /* kmalloc failure - client must retry */
a72d5318846d67 Chuck Lever    2021-08-05  832  
a72d5318846d67 Chuck Lever    2021-08-05  833  	/* Reply's verifier */
a72d5318846d67 Chuck Lever    2021-08-05  834  	svc_putnl(resv, RPC_AUTH_NULL);
a72d5318846d67 Chuck Lever    2021-08-05  835  	if (rqstp->rq_xprt->xpt_ops->xpo_start_tls) {
a72d5318846d67 Chuck Lever    2021-08-05  836  		svc_putnl(resv, 8);
a72d5318846d67 Chuck Lever    2021-08-05  837  		memcpy(resv->iov_base + resv->iov_len, "STARTTLS", 8);
a72d5318846d67 Chuck Lever    2021-08-05  838  		resv->iov_len += 8;
a72d5318846d67 Chuck Lever    2021-08-05  839  	} else
a72d5318846d67 Chuck Lever    2021-08-05  840  		svc_putnl(resv, 0);
a72d5318846d67 Chuck Lever    2021-08-05  841  
a72d5318846d67 Chuck Lever    2021-08-05  842  	rqstp->rq_cred.cr_flavor = RPC_AUTH_TLS;
a72d5318846d67 Chuck Lever    2021-08-05  843  	return SVC_OK;
a72d5318846d67 Chuck Lever    2021-08-05  844  }
a72d5318846d67 Chuck Lever    2021-08-05  845  

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [cel:topic-rpc-with-tls 9999/9999] net/sunrpc/svcauth_unix.c:814 svcauth_tls_accept() warn: was && intended here instead of ||?
@ 2022-02-18  3:06 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-02-18  3:06 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Chuck Lever <chuck.lever@oracle.com>

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux topic-rpc-with-tls
head:   b2635ca75c1014803ce82f7cbbcc09a111852e0a
commit: b2635ca75c1014803ce82f7cbbcc09a111852e0a [9999/9999] SUNRPC: Teach server to recognize RPC_AUTH_TLS
:::::: branch date: 31 hours ago
:::::: commit date: 31 hours ago
config: x86_64-randconfig-m001 (https://download.01.org/0day-ci/archive/20220218/202202181110.sRoUO7gc-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

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

New smatch warnings:
net/sunrpc/svcauth_unix.c:814 svcauth_tls_accept() warn: was && intended here instead of ||?

Old smatch warnings:
net/sunrpc/svcauth_unix.c:721 svcauth_unix_set_client() warn: passing zero to 'PTR_ERR'
net/sunrpc/svcauth_unix.c:752 svcauth_null_accept() warn: was && intended here instead of ||?
net/sunrpc/svcauth_unix.c:898 svcauth_unix_accept() warn: was && intended here instead of ||?

vim +814 net/sunrpc/svcauth_unix.c

^1da177e4c3f415 Linus Torvalds 2005-04-16  795  
^1da177e4c3f415 Linus Torvalds 2005-04-16  796  
b2635ca75c10148 Chuck Lever    2021-08-05  797  static int
b2635ca75c10148 Chuck Lever    2021-08-05  798  svcauth_tls_accept(struct svc_rqst *rqstp, __be32 *authp)
b2635ca75c10148 Chuck Lever    2021-08-05  799  {
b2635ca75c10148 Chuck Lever    2021-08-05  800  	struct svc_cred	*cred = &rqstp->rq_cred;
b2635ca75c10148 Chuck Lever    2021-08-05  801  	struct kvec *argv = rqstp->rq_arg.head;
b2635ca75c10148 Chuck Lever    2021-08-05  802  	struct kvec *resv = rqstp->rq_res.head;
b2635ca75c10148 Chuck Lever    2021-08-05  803  
b2635ca75c10148 Chuck Lever    2021-08-05  804  	if (argv->iov_len < XDR_UNIT * 3)
b2635ca75c10148 Chuck Lever    2021-08-05  805  		return SVC_GARBAGE;
b2635ca75c10148 Chuck Lever    2021-08-05  806  
b2635ca75c10148 Chuck Lever    2021-08-05  807  	/* Call's cred length */
b2635ca75c10148 Chuck Lever    2021-08-05  808  	if (svc_getu32(argv) != xdr_zero) {
b2635ca75c10148 Chuck Lever    2021-08-05  809  		*authp = rpc_autherr_badcred;
b2635ca75c10148 Chuck Lever    2021-08-05  810  		return SVC_DENIED;
b2635ca75c10148 Chuck Lever    2021-08-05  811  	}
b2635ca75c10148 Chuck Lever    2021-08-05  812  
b2635ca75c10148 Chuck Lever    2021-08-05  813  	/* Call's verifier flavor and its length */
b2635ca75c10148 Chuck Lever    2021-08-05 @814  	if (svc_getu32(argv) != rpc_auth_null ||
b2635ca75c10148 Chuck Lever    2021-08-05  815  	    svc_getu32(argv) != xdr_zero) {
b2635ca75c10148 Chuck Lever    2021-08-05  816  		*authp = rpc_autherr_badverf;
b2635ca75c10148 Chuck Lever    2021-08-05  817  		return SVC_DENIED;
b2635ca75c10148 Chuck Lever    2021-08-05  818  	}
b2635ca75c10148 Chuck Lever    2021-08-05  819  
b2635ca75c10148 Chuck Lever    2021-08-05  820  	/* AUTH_TLS is not valid on non-NULL procedures */
b2635ca75c10148 Chuck Lever    2021-08-05  821  	if (rqstp->rq_proc != 0) {
b2635ca75c10148 Chuck Lever    2021-08-05  822  		*authp = rpc_autherr_badcred;
b2635ca75c10148 Chuck Lever    2021-08-05  823  		return SVC_DENIED;
b2635ca75c10148 Chuck Lever    2021-08-05  824  	}
b2635ca75c10148 Chuck Lever    2021-08-05  825  
b2635ca75c10148 Chuck Lever    2021-08-05  826  	/* Mapping to nobody uid/gid is required */
b2635ca75c10148 Chuck Lever    2021-08-05  827  	cred->cr_uid = INVALID_UID;
b2635ca75c10148 Chuck Lever    2021-08-05  828  	cred->cr_gid = INVALID_GID;
b2635ca75c10148 Chuck Lever    2021-08-05  829  	cred->cr_group_info = groups_alloc(0);
b2635ca75c10148 Chuck Lever    2021-08-05  830  	if (cred->cr_group_info == NULL)
b2635ca75c10148 Chuck Lever    2021-08-05  831  		return SVC_CLOSE; /* kmalloc failure - client must retry */
b2635ca75c10148 Chuck Lever    2021-08-05  832  
b2635ca75c10148 Chuck Lever    2021-08-05  833  	/* Reply's verifier */
b2635ca75c10148 Chuck Lever    2021-08-05  834  	svc_putnl(resv, RPC_AUTH_NULL);
b2635ca75c10148 Chuck Lever    2021-08-05  835  	if (rqstp->rq_xprt->xpt_ops->xpo_start_tls) {
b2635ca75c10148 Chuck Lever    2021-08-05  836  		svc_putnl(resv, 8);
b2635ca75c10148 Chuck Lever    2021-08-05  837  		memcpy(resv->iov_base + resv->iov_len, "STARTTLS", 8);
b2635ca75c10148 Chuck Lever    2021-08-05  838  		resv->iov_len += 8;
b2635ca75c10148 Chuck Lever    2021-08-05  839  	} else
b2635ca75c10148 Chuck Lever    2021-08-05  840  		svc_putnl(resv, 0);
b2635ca75c10148 Chuck Lever    2021-08-05  841  
b2635ca75c10148 Chuck Lever    2021-08-05  842  	rqstp->rq_cred.cr_flavor = RPC_AUTH_TLS;
b2635ca75c10148 Chuck Lever    2021-08-05  843  	return SVC_OK;
b2635ca75c10148 Chuck Lever    2021-08-05  844  }
b2635ca75c10148 Chuck Lever    2021-08-05  845  

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-18  3:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-22  5:28 [cel:topic-rpc-with-tls 9999/9999] net/sunrpc/svcauth_unix.c:814 svcauth_tls_accept() warn: was && intended here instead of ||? kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2022-02-18  3:06 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.