hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/net/phonet/pep.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * File: pep.c
34 *
....@@ -6,20 +7,6 @@
67 * Copyright (C) 2008 Nokia Corporation.
78 *
89 * 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
2310 */
2411
2512 #include <linux/kernel.h>
....@@ -381,7 +368,7 @@
381368 err = -EINVAL;
382369 goto out;
383370 }
384
- /* fall through */
371
+ fallthrough;
385372 case PNS_PEP_DISABLE_REQ:
386373 atomic_set(&pn->tx_credits, 0);
387374 pep_reply(sk, skb, PN_PIPE_NO_ERROR, NULL, 0, GFP_ATOMIC);
....@@ -398,7 +385,7 @@
398385
399386 case PNS_PIPE_ALIGNED_DATA:
400387 __skb_pull(skb, 1);
401
- /* fall through */
388
+ fallthrough;
402389 case PNS_PIPE_DATA:
403390 __skb_pull(skb, 3); /* Pipe data header */
404391 if (!pn_flow_safe(pn->rx_fc)) {
....@@ -430,11 +417,11 @@
430417 err = pipe_rcv_created(sk, skb);
431418 if (err)
432419 break;
433
- /* fall through */
420
+ fallthrough;
434421 case PNS_PIPE_RESET_IND:
435422 if (!pn->init_enable)
436423 break;
437
- /* fall through */
424
+ fallthrough;
438425 case PNS_PIPE_ENABLED_IND:
439426 if (!pn_flow_safe(pn->tx_fc)) {
440427 atomic_set(&pn->tx_credits, 1);
....@@ -568,7 +555,7 @@
568555 switch (hdr->message_id) {
569556 case PNS_PIPE_ALIGNED_DATA:
570557 __skb_pull(skb, 1);
571
- /* fall through */
558
+ fallthrough;
572559 case PNS_PIPE_DATA:
573560 __skb_pull(skb, 3); /* Pipe data header */
574561 if (!pn_flow_safe(pn->rx_fc)) {
....@@ -991,7 +978,7 @@
991978 }
992979
993980 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)
995982 {
996983 struct pep_sock *pn = pep_sk(sk);
997984 int val = 0, err = 0;
....@@ -999,7 +986,7 @@
999986 if (level != SOL_PNPIPE)
1000987 return -ENOPROTOOPT;
1001988 if (optlen >= sizeof(int)) {
1002
- if (get_user(val, (int __user *) optval))
989
+ if (copy_from_sockptr(&val, optval, sizeof(int)))
1003990 return -EFAULT;
1004991 }
1005992