Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 00cfaa94 authored by Daniel Walter's avatar Daniel Walter Committed by Trond Myklebust
Browse files

replace strict_strto calls



Replace obsolete strict_strto calls with appropriate kstrto calls

Signed-off-by: default avatarDaniel Walter <dwalter@google.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent 00216026
Loading
Loading
Loading
Loading
+6 −10
Original line number Original line Diff line number Diff line
@@ -176,7 +176,7 @@ static int rpc_parse_scope_id(struct net *net, const char *buf,
	len = (buf + buflen) - delim - 1;
	len = (buf + buflen) - delim - 1;
	p = kstrndup(delim + 1, len, GFP_KERNEL);
	p = kstrndup(delim + 1, len, GFP_KERNEL);
	if (p) {
	if (p) {
		unsigned long scope_id = 0;
		u32 scope_id = 0;
		struct net_device *dev;
		struct net_device *dev;


		dev = dev_get_by_name(net, p);
		dev = dev_get_by_name(net, p);
@@ -184,7 +184,7 @@ static int rpc_parse_scope_id(struct net *net, const char *buf,
			scope_id = dev->ifindex;
			scope_id = dev->ifindex;
			dev_put(dev);
			dev_put(dev);
		} else {
		} else {
			if (strict_strtoul(p, 10, &scope_id) == 0) {
			if (kstrtou32(p, 10, &scope_id) == 0) {
				kfree(p);
				kfree(p);
				return 0;
				return 0;
			}
			}
@@ -304,7 +304,7 @@ char *rpc_sockaddr2uaddr(const struct sockaddr *sap, gfp_t gfp_flags)
 * @sap: buffer into which to plant socket address
 * @sap: buffer into which to plant socket address
 * @salen: size of buffer
 * @salen: size of buffer
 *
 *
 * @uaddr does not have to be '\0'-terminated, but strict_strtoul() and
 * @uaddr does not have to be '\0'-terminated, but kstrtou8() and
 * rpc_pton() require proper string termination to be successful.
 * rpc_pton() require proper string termination to be successful.
 *
 *
 * Returns the size of the socket address if successful; otherwise
 * Returns the size of the socket address if successful; otherwise
@@ -315,7 +315,7 @@ size_t rpc_uaddr2sockaddr(struct net *net, const char *uaddr,
			  const size_t salen)
			  const size_t salen)
{
{
	char *c, buf[RPCBIND_MAXUADDRLEN + sizeof('\0')];
	char *c, buf[RPCBIND_MAXUADDRLEN + sizeof('\0')];
	unsigned long portlo, porthi;
	u8 portlo, porthi;
	unsigned short port;
	unsigned short port;


	if (uaddr_len > RPCBIND_MAXUADDRLEN)
	if (uaddr_len > RPCBIND_MAXUADDRLEN)
@@ -327,18 +327,14 @@ size_t rpc_uaddr2sockaddr(struct net *net, const char *uaddr,
	c = strrchr(buf, '.');
	c = strrchr(buf, '.');
	if (unlikely(c == NULL))
	if (unlikely(c == NULL))
		return 0;
		return 0;
	if (unlikely(strict_strtoul(c + 1, 10, &portlo) != 0))
	if (unlikely(kstrtou8(c + 1, 10, &portlo) != 0))
		return 0;
	if (unlikely(portlo > 255))
		return 0;
		return 0;


	*c = '\0';
	*c = '\0';
	c = strrchr(buf, '.');
	c = strrchr(buf, '.');
	if (unlikely(c == NULL))
	if (unlikely(c == NULL))
		return 0;
		return 0;
	if (unlikely(strict_strtoul(c + 1, 10, &porthi) != 0))
	if (unlikely(kstrtou8(c + 1, 10, &porthi) != 0))
		return 0;
	if (unlikely(porthi > 255))
		return 0;
		return 0;


	port = (unsigned short)((porthi << 8) | portlo);
	port = (unsigned short)((porthi << 8) | portlo);
+1 −1
Original line number Original line Diff line number Diff line
@@ -48,7 +48,7 @@ static int param_set_hashtbl_sz(const char *val, const struct kernel_param *kp)


	if (!val)
	if (!val)
		goto out_inval;
		goto out_inval;
	ret = strict_strtoul(val, 0, &num);
	ret = kstrtoul(val, 0, &num);
	if (ret == -EINVAL)
	if (ret == -EINVAL)
		goto out_inval;
		goto out_inval;
	nbits = fls(num);
	nbits = fls(num);
+2 −2
Original line number Original line Diff line number Diff line
@@ -3059,12 +3059,12 @@ static int param_set_uint_minmax(const char *val,
		const struct kernel_param *kp,
		const struct kernel_param *kp,
		unsigned int min, unsigned int max)
		unsigned int min, unsigned int max)
{
{
	unsigned long num;
	unsigned int num;
	int ret;
	int ret;


	if (!val)
	if (!val)
		return -EINVAL;
		return -EINVAL;
	ret = strict_strtoul(val, 0, &num);
	ret = kstrtouint(val, 0, &num);
	if (ret == -EINVAL || num < min || num > max)
	if (ret == -EINVAL || num < min || num > max)
		return -EINVAL;
		return -EINVAL;
	*((unsigned int *)kp->arg) = num;
	*((unsigned int *)kp->arg) = num;