| .. | .. | 
|---|
 | 1 | +// SPDX-License-Identifier: GPL-2.0-only  | 
|---|
| 1 | 2 |  /* | 
|---|
| 2 | 3 |   * File: pep.c | 
|---|
| 3 | 4 |   * | 
|---|
| .. | .. | 
|---|
| 6 | 7 |   * Copyright (C) 2008 Nokia Corporation. | 
|---|
| 7 | 8 |   * | 
|---|
| 8 | 9 |   * Author: Rémi Denis-Courmont | 
|---|
| 9 |  | - *  | 
|---|
| 10 |  | - * This program is free software; you can redistribute it and/or  | 
|---|
| 11 |  | - * modify it under the terms of the GNU General Public License  | 
|---|
| 12 |  | - * version 2 as published by the Free Software Foundation.  | 
|---|
| 13 |  | - *  | 
|---|
| 14 |  | - * This program is distributed in the hope that it will be useful, but  | 
|---|
| 15 |  | - * WITHOUT ANY WARRANTY; without even the implied warranty of  | 
|---|
| 16 |  | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  | 
|---|
| 17 |  | - * General Public License for more details.  | 
|---|
| 18 |  | - *  | 
|---|
| 19 |  | - * You should have received a copy of the GNU General Public License  | 
|---|
| 20 |  | - * along with this program; if not, write to the Free Software  | 
|---|
| 21 |  | - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  | 
|---|
| 22 |  | - * 02110-1301 USA  | 
|---|
| 23 | 10 |   */ | 
|---|
| 24 | 11 |   | 
|---|
| 25 | 12 |  #include <linux/kernel.h> | 
|---|
| .. | .. | 
|---|
| 381 | 368 |  			err = -EINVAL; | 
|---|
| 382 | 369 |  			goto out; | 
|---|
| 383 | 370 |  		} | 
|---|
| 384 |  | -		/* fall through */  | 
|---|
 | 371 | +		fallthrough;  | 
|---|
| 385 | 372 |  	case PNS_PEP_DISABLE_REQ: | 
|---|
| 386 | 373 |  		atomic_set(&pn->tx_credits, 0); | 
|---|
| 387 | 374 |  		pep_reply(sk, skb, PN_PIPE_NO_ERROR, NULL, 0, GFP_ATOMIC); | 
|---|
| .. | .. | 
|---|
| 398 | 385 |   | 
|---|
| 399 | 386 |  	case PNS_PIPE_ALIGNED_DATA: | 
|---|
| 400 | 387 |  		__skb_pull(skb, 1); | 
|---|
| 401 |  | -		/* fall through */  | 
|---|
 | 388 | +		fallthrough;  | 
|---|
| 402 | 389 |  	case PNS_PIPE_DATA: | 
|---|
| 403 | 390 |  		__skb_pull(skb, 3); /* Pipe data header */ | 
|---|
| 404 | 391 |  		if (!pn_flow_safe(pn->rx_fc)) { | 
|---|
| .. | .. | 
|---|
| 430 | 417 |  		err = pipe_rcv_created(sk, skb); | 
|---|
| 431 | 418 |  		if (err) | 
|---|
| 432 | 419 |  			break; | 
|---|
| 433 |  | -		/* fall through */  | 
|---|
 | 420 | +		fallthrough;  | 
|---|
| 434 | 421 |  	case PNS_PIPE_RESET_IND: | 
|---|
| 435 | 422 |  		if (!pn->init_enable) | 
|---|
| 436 | 423 |  			break; | 
|---|
| 437 |  | -		/* fall through */  | 
|---|
 | 424 | +		fallthrough;  | 
|---|
| 438 | 425 |  	case PNS_PIPE_ENABLED_IND: | 
|---|
| 439 | 426 |  		if (!pn_flow_safe(pn->tx_fc)) { | 
|---|
| 440 | 427 |  			atomic_set(&pn->tx_credits, 1); | 
|---|
| .. | .. | 
|---|
| 568 | 555 |  	switch (hdr->message_id) { | 
|---|
| 569 | 556 |  	case PNS_PIPE_ALIGNED_DATA: | 
|---|
| 570 | 557 |  		__skb_pull(skb, 1); | 
|---|
| 571 |  | -		/* fall through */  | 
|---|
 | 558 | +		fallthrough;  | 
|---|
| 572 | 559 |  	case PNS_PIPE_DATA: | 
|---|
| 573 | 560 |  		__skb_pull(skb, 3); /* Pipe data header */ | 
|---|
| 574 | 561 |  		if (!pn_flow_safe(pn->rx_fc)) { | 
|---|
| .. | .. | 
|---|
| 991 | 978 |  } | 
|---|
| 992 | 979 |   | 
|---|
| 993 | 980 |  static int pep_setsockopt(struct sock *sk, int level, int optname, | 
|---|
| 994 |  | -				char __user *optval, unsigned int optlen)  | 
|---|
 | 981 | +			  sockptr_t optval, unsigned int optlen)  | 
|---|
| 995 | 982 |  { | 
|---|
| 996 | 983 |  	struct pep_sock *pn = pep_sk(sk); | 
|---|
| 997 | 984 |  	int val = 0, err = 0; | 
|---|
| .. | .. | 
|---|
| 999 | 986 |  	if (level != SOL_PNPIPE) | 
|---|
| 1000 | 987 |  		return -ENOPROTOOPT; | 
|---|
| 1001 | 988 |  	if (optlen >= sizeof(int)) { | 
|---|
| 1002 |  | -		if (get_user(val, (int __user *) optval))  | 
|---|
 | 989 | +		if (copy_from_sockptr(&val, optval, sizeof(int)))  | 
|---|
| 1003 | 990 |  			return -EFAULT; | 
|---|
| 1004 | 991 |  	} | 
|---|
| 1005 | 992 |   | 
|---|