[trace:ftrace/fgraph-multi 34/40] kernel/trace/fgraph.c:833:6: warning: variable 'command' set but not used
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git ftrace/fgraph-multi
head: 978dc256bd4d08df876d58b4fa01ba4cb3926242
commit: be13406cc12900ea57d62a9afcc33c4e11a1993f [34/40] function_graph: Have the instances use their own ftrace_ops for filtering
config: parisc-randconfig-r025-20210415 (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git/c...
git remote add trace https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
git fetch --no-tags trace ftrace/fgraph-multi
git checkout be13406cc12900ea57d62a9afcc33c4e11a1993f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=parisc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
kernel/trace/fgraph.c:481:15: warning: no previous prototype for 'ftrace_return_to_handler' [-Wmissing-prototypes]
481 | unsigned long ftrace_return_to_handler(unsigned long frame_pointer)
| ^~~~~~~~~~~~~~~~~~~~~~~~
kernel/trace/fgraph.c: In function 'ftrace_return_to_handler':
kernel/trace/fgraph.c:483:27: warning: variable 'ret_stack' set but not used [-Wunused-but-set-variable]
483 | struct ftrace_ret_stack *ret_stack;
| ^~~~~~~~~
kernel/trace/fgraph.c: At top level:
kernel/trace/fgraph.c:613:6: warning: no previous prototype for 'fgraph_init_ops' [-Wmissing-prototypes]
613 | void fgraph_init_ops(struct ftrace_ops *dst_ops,
| ^~~~~~~~~~~~~~~
kernel/trace/fgraph.c:633:6: warning: no previous prototype for 'ftrace_graph_sleep_time_control' [-Wmissing-prototypes]
633 | void ftrace_graph_sleep_time_control(bool enable)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/trace/fgraph.c:645:46: error: initialization of 'trace_func_graph_ret_t' {aka 'void (*)(struct ftrace_graph_ret *, struct fgraph_ops *)'} from incompatible pointer type 'void (*)(struct ftrace_graph_ret *)' [-Werror=incompatible-pointer-types]
645 | trace_func_graph_ret_t ftrace_graph_return = ftrace_stub_graph;
| ^~~~~~~~~~~~~~~~~
kernel/trace/fgraph.c: In function 'register_ftrace_graph':
>> kernel/trace/fgraph.c:833:6: warning: variable 'command' set but not used [-Wunused-but-set-variable]
833 | int command = 0;
| ^~~~~~~
kernel/trace/fgraph.c: In function 'unregister_ftrace_graph':
kernel/trace/fgraph.c:924:23: error: assignment to 'trace_func_graph_ret_t' {aka 'void (*)(struct ftrace_graph_ret *, struct fgraph_ops *)'} from incompatible pointer type 'void (*)(struct ftrace_graph_ret *)' [-Werror=incompatible-pointer-types]
924 | ftrace_graph_return = ftrace_stub_graph;
| ^
kernel/trace/fgraph.c:894:6: warning: variable 'command' set but not used [-Wunused-but-set-variable]
894 | int command = 0;
| ^~~~~~~
cc1: some warnings being treated as errors
vim +/command +833 kernel/trace/fgraph.c
830
831 int register_ftrace_graph(struct fgraph_ops *gops)
832 {
> 833 int command = 0;
834 int ret = 0;
835 int i;
836
837 mutex_lock(&ftrace_lock);
838
839 if (!gops->ops.func) {
840 gops->ops.flags |= FTRACE_OPS_FL_STUB;
841 gops->ops.func = ftrace_stub;
842 #ifdef FTRACE_GRAPH_TRAMP_ADDR
843 gops->ops.trampoline = FTRACE_GRAPH_TRAMP_ADDR;
844 #endif
845 }
846
847 if (!fgraph_array[0]) {
848 /* The array must always have real data on it */
849 for (i = 0; i < FGRAPH_ARRAY_SIZE; i++) {
850 fgraph_array[i] = &fgraph_stub;
851 }
852 }
853
854 /* Look for an available spot */
855 for (i = 0; i < FGRAPH_ARRAY_SIZE; i++) {
856 if (fgraph_array[i] == &fgraph_stub)
857 break;
858 }
859 if (i >= FGRAPH_ARRAY_SIZE) {
860 ret = -EBUSY;
861 goto out;
862 }
863
864 fgraph_array[i] = gops;
865 if (i + 1 > fgraph_array_cnt)
866 fgraph_array_cnt = i + 1;
867
868 ftrace_graph_active++;
869
870 if (ftrace_graph_active == 1) {
871 register_pm_notifier(&ftrace_suspend_notifier);
872 ret = start_graph_tracing();
873 if (ret) {
874 ftrace_graph_active--;
875 goto out;
876 }
877 /*
878 * Some archs just test to see if these are not
879 * the default function
880 */
881 ftrace_graph_return = return_run;
882 ftrace_graph_entry = entry_run;
883 command = FTRACE_START_FUNC_RET;
884 }
885
886 ret = ftrace_startup(&gops->ops, command);
887 out:
888 mutex_unlock(&ftrace_lock);
889 return ret;
890 }
891
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 5 months
[lwn:docs-next 127/127] drivers/scsi/fnic/fnic_fcs.c:299: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
by kernel test robot
tree: git://git.lwn.net/linux-2.6 docs-next
head: f9bbc12ccb35ac8b3fa01cec1a19cb523a7707c7
commit: f9bbc12ccb35ac8b3fa01cec1a19cb523a7707c7 [127/127] scripts: kernel-doc: improve parsing for kernel-doc comments syntax
config: x86_64-randconfig-a015-20210415 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 6a18cc23efad410db48a3ccfc233d215de7d4cb9)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
git remote add lwn git://git.lwn.net/linux-2.6
git fetch --no-tags lwn docs-next
git checkout f9bbc12ccb35ac8b3fa01cec1a19cb523a7707c7
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
>> drivers/scsi/fnic/fnic_fcs.c:299: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
* Check if the Received FIP FLOGI frame is rejected
vim +299 drivers/scsi/fnic/fnic_fcs.c
d3c995f1dcf938 Hiral Patel 2013-02-25 297
d3c995f1dcf938 Hiral Patel 2013-02-25 298 /**
d3c995f1dcf938 Hiral Patel 2013-02-25 @299 * Check if the Received FIP FLOGI frame is rejected
d3c995f1dcf938 Hiral Patel 2013-02-25 300 * @fip: The FCoE controller that received the frame
d3c995f1dcf938 Hiral Patel 2013-02-25 301 * @skb: The received FIP frame
d3c995f1dcf938 Hiral Patel 2013-02-25 302 *
d3c995f1dcf938 Hiral Patel 2013-02-25 303 * Returns non-zero if the frame is rejected with unsupported cmd with
d3c995f1dcf938 Hiral Patel 2013-02-25 304 * insufficient resource els explanation.
d3c995f1dcf938 Hiral Patel 2013-02-25 305 */
d3c995f1dcf938 Hiral Patel 2013-02-25 306 static inline int is_fnic_fip_flogi_reject(struct fcoe_ctlr *fip,
d3c995f1dcf938 Hiral Patel 2013-02-25 307 struct sk_buff *skb)
d3c995f1dcf938 Hiral Patel 2013-02-25 308 {
d3c995f1dcf938 Hiral Patel 2013-02-25 309 struct fc_lport *lport = fip->lp;
d3c995f1dcf938 Hiral Patel 2013-02-25 310 struct fip_header *fiph;
d3c995f1dcf938 Hiral Patel 2013-02-25 311 struct fc_frame_header *fh = NULL;
d3c995f1dcf938 Hiral Patel 2013-02-25 312 struct fip_desc *desc;
d3c995f1dcf938 Hiral Patel 2013-02-25 313 struct fip_encaps *els;
d3c995f1dcf938 Hiral Patel 2013-02-25 314 u16 op;
d3c995f1dcf938 Hiral Patel 2013-02-25 315 u8 els_op;
d3c995f1dcf938 Hiral Patel 2013-02-25 316 u8 sub;
d3c995f1dcf938 Hiral Patel 2013-02-25 317
d3c995f1dcf938 Hiral Patel 2013-02-25 318 size_t rlen;
d3c995f1dcf938 Hiral Patel 2013-02-25 319 size_t dlen = 0;
d3c995f1dcf938 Hiral Patel 2013-02-25 320
d3c995f1dcf938 Hiral Patel 2013-02-25 321 if (skb_linearize(skb))
d3c995f1dcf938 Hiral Patel 2013-02-25 322 return 0;
d3c995f1dcf938 Hiral Patel 2013-02-25 323
d3c995f1dcf938 Hiral Patel 2013-02-25 324 if (skb->len < sizeof(*fiph))
d3c995f1dcf938 Hiral Patel 2013-02-25 325 return 0;
d3c995f1dcf938 Hiral Patel 2013-02-25 326
d3c995f1dcf938 Hiral Patel 2013-02-25 327 fiph = (struct fip_header *)skb->data;
d3c995f1dcf938 Hiral Patel 2013-02-25 328 op = ntohs(fiph->fip_op);
d3c995f1dcf938 Hiral Patel 2013-02-25 329 sub = fiph->fip_subcode;
d3c995f1dcf938 Hiral Patel 2013-02-25 330
d3c995f1dcf938 Hiral Patel 2013-02-25 331 if (op != FIP_OP_LS)
d3c995f1dcf938 Hiral Patel 2013-02-25 332 return 0;
d3c995f1dcf938 Hiral Patel 2013-02-25 333
d3c995f1dcf938 Hiral Patel 2013-02-25 334 if (sub != FIP_SC_REP)
d3c995f1dcf938 Hiral Patel 2013-02-25 335 return 0;
d3c995f1dcf938 Hiral Patel 2013-02-25 336
d3c995f1dcf938 Hiral Patel 2013-02-25 337 rlen = ntohs(fiph->fip_dl_len) * 4;
d3c995f1dcf938 Hiral Patel 2013-02-25 338 if (rlen + sizeof(*fiph) > skb->len)
d3c995f1dcf938 Hiral Patel 2013-02-25 339 return 0;
d3c995f1dcf938 Hiral Patel 2013-02-25 340
d3c995f1dcf938 Hiral Patel 2013-02-25 341 desc = (struct fip_desc *)(fiph + 1);
d3c995f1dcf938 Hiral Patel 2013-02-25 342 dlen = desc->fip_dlen * FIP_BPW;
d3c995f1dcf938 Hiral Patel 2013-02-25 343
d3c995f1dcf938 Hiral Patel 2013-02-25 344 if (desc->fip_dtype == FIP_DT_FLOGI) {
d3c995f1dcf938 Hiral Patel 2013-02-25 345
d3c995f1dcf938 Hiral Patel 2013-02-25 346 if (dlen < sizeof(*els) + sizeof(*fh) + 1)
d3c995f1dcf938 Hiral Patel 2013-02-25 347 return 0;
d3c995f1dcf938 Hiral Patel 2013-02-25 348
d3c995f1dcf938 Hiral Patel 2013-02-25 349 els = (struct fip_encaps *)desc;
d3c995f1dcf938 Hiral Patel 2013-02-25 350 fh = (struct fc_frame_header *)(els + 1);
d3c995f1dcf938 Hiral Patel 2013-02-25 351
d3c995f1dcf938 Hiral Patel 2013-02-25 352 if (!fh)
d3c995f1dcf938 Hiral Patel 2013-02-25 353 return 0;
d3c995f1dcf938 Hiral Patel 2013-02-25 354
d3c995f1dcf938 Hiral Patel 2013-02-25 355 /*
d3c995f1dcf938 Hiral Patel 2013-02-25 356 * ELS command code, reason and explanation should be = Reject,
d3c995f1dcf938 Hiral Patel 2013-02-25 357 * unsupported command and insufficient resource
d3c995f1dcf938 Hiral Patel 2013-02-25 358 */
d3c995f1dcf938 Hiral Patel 2013-02-25 359 els_op = *(u8 *)(fh + 1);
d3c995f1dcf938 Hiral Patel 2013-02-25 360 if (els_op == ELS_LS_RJT) {
d3c995f1dcf938 Hiral Patel 2013-02-25 361 shost_printk(KERN_INFO, lport->host,
d3c995f1dcf938 Hiral Patel 2013-02-25 362 "Flogi Request Rejected by Switch\n");
d3c995f1dcf938 Hiral Patel 2013-02-25 363 return 1;
d3c995f1dcf938 Hiral Patel 2013-02-25 364 }
d3c995f1dcf938 Hiral Patel 2013-02-25 365 shost_printk(KERN_INFO, lport->host,
d3c995f1dcf938 Hiral Patel 2013-02-25 366 "Flogi Request Accepted by Switch\n");
d3c995f1dcf938 Hiral Patel 2013-02-25 367 }
d3c995f1dcf938 Hiral Patel 2013-02-25 368 return 0;
d3c995f1dcf938 Hiral Patel 2013-02-25 369 }
d3c995f1dcf938 Hiral Patel 2013-02-25 370
:::::: The code at line 299 was first introduced by commit
:::::: d3c995f1dcf938f1084388d92b8fb97bec366566 [SCSI] fnic: FIP VLAN Discovery Feature Support
:::::: TO: Hiral Patel <hiralpat(a)cisco.com>
:::::: CC: James Bottomley <JBottomley(a)Parallels.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 5 months
[android-common:android-4.19 12/14] drivers/nvdimm/nd_virtio.c:56:28: sparse: sparse: incorrect type in assignment (different base types)
by kernel test robot
tree: https://android.googlesource.com/kernel/common android-4.19
head: 45a6d3f5180d2d65d6d83fc9ecfa93fd2a332a67
commit: 748a437c5c0179283ae1814b612f9e1a744f3839 [12/14] UPSTREAM: virtio-pmem: Add virtio pmem driver
config: x86_64-randconfig-s021-20210415 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-280-g2cd6d34e-dirty
git remote add android-common https://android.googlesource.com/kernel/common
git fetch --no-tags android-common android-4.19
git checkout 748a437c5c0179283ae1814b612f9e1a744f3839
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/nvdimm/nd_virtio.c:56:28: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] type @@ got restricted __virtio32 @@
drivers/nvdimm/nd_virtio.c:56:28: sparse: expected unsigned int [usertype] type
drivers/nvdimm/nd_virtio.c:56:28: sparse: got restricted __virtio32
>> drivers/nvdimm/nd_virtio.c:93:59: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected restricted __virtio32 [usertype] val @@ got unsigned int [usertype] ret @@
drivers/nvdimm/nd_virtio.c:93:59: sparse: expected restricted __virtio32 [usertype] val
drivers/nvdimm/nd_virtio.c:93:59: sparse: got unsigned int [usertype] ret
vim +56 drivers/nvdimm/nd_virtio.c
36
37 /* The request submission function */
38 static int virtio_pmem_flush(struct nd_region *nd_region)
39 {
40 struct virtio_device *vdev = nd_region->provider_data;
41 struct virtio_pmem *vpmem = vdev->priv;
42 struct virtio_pmem_request *req_data;
43 struct scatterlist *sgs[2], sg, ret;
44 unsigned long flags;
45 int err, err1;
46
47 might_sleep();
48 req_data = kmalloc(sizeof(*req_data), GFP_KERNEL);
49 if (!req_data)
50 return -ENOMEM;
51
52 req_data->done = false;
53 init_waitqueue_head(&req_data->host_acked);
54 init_waitqueue_head(&req_data->wq_buf);
55 INIT_LIST_HEAD(&req_data->list);
> 56 req_data->req.type = cpu_to_virtio32(vdev, VIRTIO_PMEM_REQ_TYPE_FLUSH);
57 sg_init_one(&sg, &req_data->req, sizeof(req_data->req));
58 sgs[0] = &sg;
59 sg_init_one(&ret, &req_data->resp.ret, sizeof(req_data->resp));
60 sgs[1] = &ret;
61
62 spin_lock_irqsave(&vpmem->pmem_lock, flags);
63 /*
64 * If virtqueue_add_sgs returns -ENOSPC then req_vq virtual
65 * queue does not have free descriptor. We add the request
66 * to req_list and wait for host_ack to wake us up when free
67 * slots are available.
68 */
69 while ((err = virtqueue_add_sgs(vpmem->req_vq, sgs, 1, 1, req_data,
70 GFP_ATOMIC)) == -ENOSPC) {
71
72 dev_info(&vdev->dev, "failed to send command to virtio pmem device, no free slots in the virtqueue\n");
73 req_data->wq_buf_avail = false;
74 list_add_tail(&req_data->list, &vpmem->req_list);
75 spin_unlock_irqrestore(&vpmem->pmem_lock, flags);
76
77 /* A host response results in "host_ack" getting called */
78 wait_event(req_data->wq_buf, req_data->wq_buf_avail);
79 spin_lock_irqsave(&vpmem->pmem_lock, flags);
80 }
81 err1 = virtqueue_kick(vpmem->req_vq);
82 spin_unlock_irqrestore(&vpmem->pmem_lock, flags);
83 /*
84 * virtqueue_add_sgs failed with error different than -ENOSPC, we can't
85 * do anything about that.
86 */
87 if (err || !err1) {
88 dev_info(&vdev->dev, "failed to send command to virtio pmem device\n");
89 err = -EIO;
90 } else {
91 /* A host repsonse results in "host_ack" getting called */
92 wait_event(req_data->host_acked, req_data->done);
> 93 err = virtio32_to_cpu(vdev, req_data->resp.ret);
94 }
95
96 kfree(req_data);
97 return err;
98 };
99
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 5 months
[lwn:docs-next 127/127] sound/soc/codecs/nau8825.c:358: warning: expecting prototype for Computes log10 of a value; the result is round off to 3 decimal. This func(). Prototype was for nau8825_intlog10_dec3() instead
by kernel test robot
tree: git://git.lwn.net/linux-2.6 docs-next
head: f9bbc12ccb35ac8b3fa01cec1a19cb523a7707c7
commit: f9bbc12ccb35ac8b3fa01cec1a19cb523a7707c7 [127/127] scripts: kernel-doc: improve parsing for kernel-doc comments syntax
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git remote add lwn git://git.lwn.net/linux-2.6
git fetch --no-tags lwn docs-next
git checkout f9bbc12ccb35ac8b3fa01cec1a19cb523a7707c7
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=arc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
sound/soc/codecs/nau8825.c:298: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
* Ramp up the headphone volume change gradually to target level.
>> sound/soc/codecs/nau8825.c:358: warning: expecting prototype for Computes log10 of a value; the result is round off to 3 decimal. This func(). Prototype was for nau8825_intlog10_dec3() instead
sound/soc/codecs/nau8825.c:411: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
* computes cross talk suppression sidetone gain.
vim +358 sound/soc/codecs/nau8825.c
b50455fab459b0b John Hsu 2016-06-07 296
b50455fab459b0b John Hsu 2016-06-07 297 /**
b50455fab459b0b John Hsu 2016-06-07 @298 * Ramp up the headphone volume change gradually to target level.
b50455fab459b0b John Hsu 2016-06-07 299 *
b50455fab459b0b John Hsu 2016-06-07 300 * @nau8825: component to register the codec private data with
b50455fab459b0b John Hsu 2016-06-07 301 * @vol_from: the volume to start up
b50455fab459b0b John Hsu 2016-06-07 302 * @vol_to: the target volume
b50455fab459b0b John Hsu 2016-06-07 303 * @step: the volume span to move on
b50455fab459b0b John Hsu 2016-06-07 304 *
b50455fab459b0b John Hsu 2016-06-07 305 * The headphone volume is from 0dB to minimum -54dB and -1dB per step.
b50455fab459b0b John Hsu 2016-06-07 306 * If the volume changes sharp, there is a pop noise heard in headphone. We
b50455fab459b0b John Hsu 2016-06-07 307 * provide the function to ramp up the volume up or down by delaying 10ms
b50455fab459b0b John Hsu 2016-06-07 308 * per step.
b50455fab459b0b John Hsu 2016-06-07 309 */
b50455fab459b0b John Hsu 2016-06-07 310 static void nau8825_hpvol_ramp(struct nau8825 *nau8825,
b50455fab459b0b John Hsu 2016-06-07 311 unsigned int vol_from, unsigned int vol_to, unsigned int step)
b50455fab459b0b John Hsu 2016-06-07 312 {
b50455fab459b0b John Hsu 2016-06-07 313 unsigned int value, volume, ramp_up, from, to;
b50455fab459b0b John Hsu 2016-06-07 314
b50455fab459b0b John Hsu 2016-06-07 315 if (vol_from == vol_to || step == 0) {
b50455fab459b0b John Hsu 2016-06-07 316 return;
b50455fab459b0b John Hsu 2016-06-07 317 } else if (vol_from < vol_to) {
b50455fab459b0b John Hsu 2016-06-07 318 ramp_up = true;
b50455fab459b0b John Hsu 2016-06-07 319 from = vol_from;
b50455fab459b0b John Hsu 2016-06-07 320 to = vol_to;
b50455fab459b0b John Hsu 2016-06-07 321 } else {
b50455fab459b0b John Hsu 2016-06-07 322 ramp_up = false;
b50455fab459b0b John Hsu 2016-06-07 323 from = vol_to;
b50455fab459b0b John Hsu 2016-06-07 324 to = vol_from;
b50455fab459b0b John Hsu 2016-06-07 325 }
b50455fab459b0b John Hsu 2016-06-07 326 /* only handle volume from 0dB to minimum -54dB */
b50455fab459b0b John Hsu 2016-06-07 327 if (to > NAU8825_HP_VOL_MIN)
b50455fab459b0b John Hsu 2016-06-07 328 to = NAU8825_HP_VOL_MIN;
b50455fab459b0b John Hsu 2016-06-07 329
b50455fab459b0b John Hsu 2016-06-07 330 for (volume = from; volume < to; volume += step) {
b50455fab459b0b John Hsu 2016-06-07 331 if (ramp_up)
b50455fab459b0b John Hsu 2016-06-07 332 value = volume;
b50455fab459b0b John Hsu 2016-06-07 333 else
b50455fab459b0b John Hsu 2016-06-07 334 value = to - volume + from;
b50455fab459b0b John Hsu 2016-06-07 335 regmap_update_bits(nau8825->regmap, NAU8825_REG_HSVOL_CTRL,
b50455fab459b0b John Hsu 2016-06-07 336 NAU8825_HPL_VOL_MASK | NAU8825_HPR_VOL_MASK,
b50455fab459b0b John Hsu 2016-06-07 337 (value << NAU8825_HPL_VOL_SFT) | value);
b50455fab459b0b John Hsu 2016-06-07 338 usleep_range(10000, 10500);
b50455fab459b0b John Hsu 2016-06-07 339 }
b50455fab459b0b John Hsu 2016-06-07 340 if (ramp_up)
b50455fab459b0b John Hsu 2016-06-07 341 value = to;
b50455fab459b0b John Hsu 2016-06-07 342 else
b50455fab459b0b John Hsu 2016-06-07 343 value = from;
b50455fab459b0b John Hsu 2016-06-07 344 regmap_update_bits(nau8825->regmap, NAU8825_REG_HSVOL_CTRL,
b50455fab459b0b John Hsu 2016-06-07 345 NAU8825_HPL_VOL_MASK | NAU8825_HPR_VOL_MASK,
b50455fab459b0b John Hsu 2016-06-07 346 (value << NAU8825_HPL_VOL_SFT) | value);
b50455fab459b0b John Hsu 2016-06-07 347 }
b50455fab459b0b John Hsu 2016-06-07 348
b50455fab459b0b John Hsu 2016-06-07 349 /**
b50455fab459b0b John Hsu 2016-06-07 350 * Computes log10 of a value; the result is round off to 3 decimal. This func-
b50455fab459b0b John Hsu 2016-06-07 351 * tion takes reference to dvb-math. The source code locates as the following.
b50455fab459b0b John Hsu 2016-06-07 352 * Linux/drivers/media/dvb-core/dvb_math.c
dc22a4093f5d297 Pierre-Louis Bossart 2019-01-04 353 * @value: input for log10
b50455fab459b0b John Hsu 2016-06-07 354 *
b50455fab459b0b John Hsu 2016-06-07 355 * return log10(value) * 1000
b50455fab459b0b John Hsu 2016-06-07 356 */
b50455fab459b0b John Hsu 2016-06-07 357 static u32 nau8825_intlog10_dec3(u32 value)
b50455fab459b0b John Hsu 2016-06-07 @358 {
b50455fab459b0b John Hsu 2016-06-07 359 u32 msb, logentry, significand, interpolation, log10val;
b50455fab459b0b John Hsu 2016-06-07 360 u64 log2val;
b50455fab459b0b John Hsu 2016-06-07 361
b50455fab459b0b John Hsu 2016-06-07 362 /* first detect the msb (count begins at 0) */
b50455fab459b0b John Hsu 2016-06-07 363 msb = fls(value) - 1;
b50455fab459b0b John Hsu 2016-06-07 364 /**
b50455fab459b0b John Hsu 2016-06-07 365 * now we use a logtable after the following method:
b50455fab459b0b John Hsu 2016-06-07 366 *
b50455fab459b0b John Hsu 2016-06-07 367 * log2(2^x * y) * 2^24 = x * 2^24 + log2(y) * 2^24
b50455fab459b0b John Hsu 2016-06-07 368 * where x = msb and therefore 1 <= y < 2
b50455fab459b0b John Hsu 2016-06-07 369 * first y is determined by shifting the value left
b50455fab459b0b John Hsu 2016-06-07 370 * so that msb is bit 31
b50455fab459b0b John Hsu 2016-06-07 371 * 0x00231f56 -> 0x8C7D5800
b50455fab459b0b John Hsu 2016-06-07 372 * the result is y * 2^31 -> "significand"
b50455fab459b0b John Hsu 2016-06-07 373 * then the highest 9 bits are used for a table lookup
b50455fab459b0b John Hsu 2016-06-07 374 * the highest bit is discarded because it's always set
b50455fab459b0b John Hsu 2016-06-07 375 * the highest nine bits in our example are 100011000
b50455fab459b0b John Hsu 2016-06-07 376 * so we would use the entry 0x18
b50455fab459b0b John Hsu 2016-06-07 377 */
b50455fab459b0b John Hsu 2016-06-07 378 significand = value << (31 - msb);
b50455fab459b0b John Hsu 2016-06-07 379 logentry = (significand >> 23) & 0xff;
b50455fab459b0b John Hsu 2016-06-07 380 /**
b50455fab459b0b John Hsu 2016-06-07 381 * last step we do is interpolation because of the
b50455fab459b0b John Hsu 2016-06-07 382 * limitations of the log table the error is that part of
b50455fab459b0b John Hsu 2016-06-07 383 * the significand which isn't used for lookup then we
b50455fab459b0b John Hsu 2016-06-07 384 * compute the ratio between the error and the next table entry
b50455fab459b0b John Hsu 2016-06-07 385 * and interpolate it between the log table entry used and the
b50455fab459b0b John Hsu 2016-06-07 386 * next one the biggest error possible is 0x7fffff
b50455fab459b0b John Hsu 2016-06-07 387 * (in our example it's 0x7D5800)
b50455fab459b0b John Hsu 2016-06-07 388 * needed value for next table entry is 0x800000
b50455fab459b0b John Hsu 2016-06-07 389 * so the interpolation is
b50455fab459b0b John Hsu 2016-06-07 390 * (error / 0x800000) * (logtable_next - logtable_current)
b50455fab459b0b John Hsu 2016-06-07 391 * in the implementation the division is moved to the end for
b50455fab459b0b John Hsu 2016-06-07 392 * better accuracy there is also an overflow correction if
b50455fab459b0b John Hsu 2016-06-07 393 * logtable_next is 256
b50455fab459b0b John Hsu 2016-06-07 394 */
b50455fab459b0b John Hsu 2016-06-07 395 interpolation = ((significand & 0x7fffff) *
b50455fab459b0b John Hsu 2016-06-07 396 ((logtable[(logentry + 1) & 0xff] -
b50455fab459b0b John Hsu 2016-06-07 397 logtable[logentry]) & 0xffff)) >> 15;
b50455fab459b0b John Hsu 2016-06-07 398
b50455fab459b0b John Hsu 2016-06-07 399 log2val = ((msb << 24) + (logtable[logentry] << 8) + interpolation);
b50455fab459b0b John Hsu 2016-06-07 400 /**
b50455fab459b0b John Hsu 2016-06-07 401 * log10(x) = log2(x) * log10(2)
b50455fab459b0b John Hsu 2016-06-07 402 */
b50455fab459b0b John Hsu 2016-06-07 403 log10val = (log2val * LOG10_MAGIC) >> 31;
b50455fab459b0b John Hsu 2016-06-07 404 /**
b50455fab459b0b John Hsu 2016-06-07 405 * the result is round off to 3 decimal
b50455fab459b0b John Hsu 2016-06-07 406 */
b50455fab459b0b John Hsu 2016-06-07 407 return log10val / ((1 << 24) / 1000);
b50455fab459b0b John Hsu 2016-06-07 408 }
b50455fab459b0b John Hsu 2016-06-07 409
:::::: The code at line 358 was first introduced by commit
:::::: b50455fab459b0ba17f6129203f77c6acce946ce ASoC: nau8825: cross talk suppression measurement function
:::::: TO: John Hsu <KCHSU0(a)nuvoton.com>
:::::: CC: Mark Brown <broonie(a)kernel.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 5 months
[gustavoars-linux:testing/warray-bounds 1/13] arch/alpha/include/asm/string.h:22:16: warning: '__builtin_memcpy' offset [3, 7] from the object at 'cmd' is out of the bounds of referenced subobject 'feature' with type 'unsigned char' at offset 1
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git testing/warray-bounds
head: 8bd0f043b3e94069930bec5cb3fbb5c857748c80
commit: 5f8bd90197ff7ab1cf9f06dd9c594f3636c71297 [1/13] Makefile: Enable -Warray-bounds
config: alpha-randconfig-r013-20210415 (attached as .config)
compiler: alpha-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/comm...
git remote add gustavoars-linux https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git
git fetch --no-tags gustavoars-linux testing/warray-bounds
git checkout 5f8bd90197ff7ab1cf9f06dd9c594f3636c71297
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=alpha
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
In file included from include/linux/string.h:21,
from include/linux/bitmap.h:10,
from include/linux/cpumask.h:12,
from include/linux/smp.h:13,
from include/linux/lockdep.h:14,
from include/linux/spinlock.h:59,
from include/linux/ipc.h:5,
from include/uapi/linux/sem.h:5,
from include/linux/sem.h:5,
from include/linux/compat.h:14,
from drivers/ide/ide-ioctls.c:6:
In function 'ide_task_ioctl',
inlined from 'generic_ide_ioctl' at drivers/ide/ide-ioctls.c:287:10:
>> arch/alpha/include/asm/string.h:22:16: warning: '__builtin_memcpy' offset [3, 7] from the object at 'cmd' is out of the bounds of referenced subobject 'feature' with type 'unsigned char' at offset 1 [-Warray-bounds]
22 | #define memcpy __builtin_memcpy
drivers/ide/ide-ioctls.c:213:2: note: in expansion of macro 'memcpy'
213 | memcpy(&cmd.tf.feature, &args[1], 6);
| ^~~~~~
>> arch/alpha/include/asm/string.h:22:16: warning: '__builtin_memcpy' offset [3, 7] from the object at 'cmd' is out of the bounds of referenced subobject 'feature' with type 'unsigned char' at offset 1 [-Warray-bounds]
22 | #define memcpy __builtin_memcpy
drivers/ide/ide-ioctls.c:221:2: note: in expansion of macro 'memcpy'
221 | memcpy(&args[1], &cmd.tf.feature, 6);
| ^~~~~~
--
In file included from include/linux/string.h:21,
from include/linux/bitmap.h:10,
from include/linux/cpumask.h:12,
from include/linux/smp.h:13,
from include/linux/lockdep.h:14,
from include/linux/spinlock.h:59,
from include/linux/wait.h:9,
from include/linux/wait_bit.h:8,
from include/linux/fs.h:6,
from include/linux/highmem.h:5,
from include/linux/bio.h:8,
from drivers/md/bcache/bcache.h:182,
from drivers/md/bcache/alloc.c:64:
In function 'pick_data_bucket',
inlined from 'bch_alloc_sectors' at drivers/md/bcache/alloc.c:627:15:
>> arch/alpha/include/asm/string.h:22:16: warning: '__builtin_memcpy' offset [17, 24] from the object at 'alloc' is out of the bounds of referenced subobject 'key' with type 'struct bkey' at offset 0 [-Warray-bounds]
22 | #define memcpy __builtin_memcpy
include/uapi/linux/bcache.h:109:32: note: in expansion of macro 'memcpy'
109 | #define bkey_copy(_dest, _src) memcpy(_dest, _src, bkey_bytes(_src))
| ^~~~~~
drivers/md/bcache/alloc.c:586:3: note: in expansion of macro 'bkey_copy'
586 | bkey_copy(&ret->key, alloc);
| ^~~~~~~~~
--
In file included from include/linux/string.h:21,
from include/linux/bitmap.h:10,
from include/linux/cpumask.h:12,
from include/linux/smp.h:13,
from include/linux/lockdep.h:14,
from include/linux/spinlock.h:59,
from include/linux/mmzone.h:8,
from include/linux/gfp.h:6,
from include/linux/umh.h:4,
from include/linux/kmod.h:9,
from include/linux/module.h:16,
from drivers/media/pci/ngene/ngene-core.c:13:
drivers/media/pci/ngene/ngene-core.c: In function 'ngene_command_config_free_buf':
>> arch/alpha/include/asm/string.h:22:16: warning: '__builtin_memcpy' offset [12, 16] from the object at 'com' is out of the bounds of referenced subobject 'config' with type 'unsigned char' at offset 10 [-Warray-bounds]
22 | #define memcpy __builtin_memcpy
drivers/media/pci/ngene/ngene-core.c:388:2: note: in expansion of macro 'memcpy'
388 | memcpy(&com.cmd.ConfigureBuffers.config, config, 6);
| ^~~~~~
vim +22 arch/alpha/include/asm/string.h
^1da177e4c3f415 include/asm-alpha/string.h Linus Torvalds 2005-04-16 21
^1da177e4c3f415 include/asm-alpha/string.h Linus Torvalds 2005-04-16 @22 #define memcpy __builtin_memcpy
^1da177e4c3f415 include/asm-alpha/string.h Linus Torvalds 2005-04-16 23
:::::: The code at line 22 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2
:::::: TO: Linus Torvalds <torvalds(a)ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds(a)ppc970.osdl.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 5 months
Re: [PATCH 07/13] sunrpc: keep track of the xprt_class in rpc_xprt structure
by kernel test robot
Hi Olga,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on nfs/linux-next]
[also build test ERROR on nfsd/nfsd-next v5.12-rc7 next-20210415]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Olga-Kornievskaia/create-sysfs-f...
base: git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
config: x86_64-randconfig-a011-20210415 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 6a18cc23efad410db48a3ccfc233d215de7d4cb9)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/eb4c4b6126d3914b950cb13c118d7b28c...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Olga-Kornievskaia/create-sysfs-files-for-changing-IP-address/20210415-102946
git checkout eb4c4b6126d3914b950cb13c118d7b28ce132dc3
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
>> net/sunrpc/xprtrdma/transport.c:353:22: error: use of undeclared identifier 'xprt_rdma'; did you mean 'xprt_rdma_bc'?
xprt->xprt_class = &xprt_rdma;
^~~~~~~~~
xprt_rdma_bc
net/sunrpc/xprtrdma/xprt_rdma.h:595:26: note: 'xprt_rdma_bc' declared here
extern struct xprt_class xprt_rdma_bc;
^
1 error generated.
vim +353 net/sunrpc/xprtrdma/transport.c
308
309 /**
310 * xprt_setup_rdma - Set up transport to use RDMA
311 *
312 * @args: rpc transport arguments
313 */
314 static struct rpc_xprt *
315 xprt_setup_rdma(struct xprt_create *args)
316 {
317 struct rpc_xprt *xprt;
318 struct rpcrdma_xprt *new_xprt;
319 struct sockaddr *sap;
320 int rc;
321
322 if (args->addrlen > sizeof(xprt->addr))
323 return ERR_PTR(-EBADF);
324
325 if (!try_module_get(THIS_MODULE))
326 return ERR_PTR(-EIO);
327
328 xprt = xprt_alloc(args->net, sizeof(struct rpcrdma_xprt), 0,
329 xprt_rdma_slot_table_entries);
330 if (!xprt) {
331 module_put(THIS_MODULE);
332 return ERR_PTR(-ENOMEM);
333 }
334
335 xprt->timeout = &xprt_rdma_default_timeout;
336 xprt->connect_timeout = xprt->timeout->to_initval;
337 xprt->max_reconnect_timeout = xprt->timeout->to_maxval;
338 xprt->bind_timeout = RPCRDMA_BIND_TO;
339 xprt->reestablish_timeout = RPCRDMA_INIT_REEST_TO;
340 xprt->idle_timeout = RPCRDMA_IDLE_DISC_TO;
341
342 xprt->resvport = 0; /* privileged port not needed */
343 xprt->ops = &xprt_rdma_procs;
344
345 /*
346 * Set up RDMA-specific connect data.
347 */
348 sap = args->dstaddr;
349
350 /* Ensure xprt->addr holds valid server TCP (not RDMA)
351 * address, for any side protocols which peek at it */
352 xprt->prot = IPPROTO_TCP;
> 353 xprt->xprt_class = &xprt_rdma;
354 xprt->addrlen = args->addrlen;
355 memcpy(&xprt->addr, sap, xprt->addrlen);
356
357 if (rpc_get_port(sap))
358 xprt_set_bound(xprt);
359 xprt_rdma_format_addresses(xprt, sap);
360
361 new_xprt = rpcx_to_rdmax(xprt);
362 rc = rpcrdma_buffer_create(new_xprt);
363 if (rc) {
364 xprt_rdma_free_addresses(xprt);
365 xprt_free(xprt);
366 module_put(THIS_MODULE);
367 return ERR_PTR(rc);
368 }
369
370 INIT_DELAYED_WORK(&new_xprt->rx_connect_worker,
371 xprt_rdma_connect_worker);
372
373 xprt->max_payload = RPCRDMA_MAX_DATA_SEGS << PAGE_SHIFT;
374
375 return xprt;
376 }
377
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 5 months
[gustavoars-linux:testing/warray-bounds 1/13] net/sctp/sm_make_chunk.c:3150:4: warning: 'memcpy' offset [17, 28] from the object at 'addr' is out of the bounds of referenced subobject 'v4' with type 'struct sockaddr_in' at offset 0
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git testing/warray-bounds
head: 8bd0f043b3e94069930bec5cb3fbb5c857748c80
commit: 5f8bd90197ff7ab1cf9f06dd9c594f3636c71297 [1/13] Makefile: Enable -Warray-bounds
config: parisc-randconfig-r016-20210415 (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/comm...
git remote add gustavoars-linux https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git
git fetch --no-tags gustavoars-linux testing/warray-bounds
git checkout 5f8bd90197ff7ab1cf9f06dd9c594f3636c71297
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=parisc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
In function 'sctp_process_asconf_param',
inlined from 'sctp_process_asconf' at net/sctp/sm_make_chunk.c:3285:14:
>> net/sctp/sm_make_chunk.c:3150:4: warning: 'memcpy' offset [17, 28] from the object at 'addr' is out of the bounds of referenced subobject 'v4' with type 'struct sockaddr_in' at offset 0 [-Warray-bounds]
3150 | memcpy(&addr.v4, sctp_source(asconf), sizeof(addr));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +3150 net/sctp/sm_make_chunk.c
^1da177e4c3f415 Linus Torvalds 2005-04-16 3026
^1da177e4c3f415 Linus Torvalds 2005-04-16 3027 /* Process a asconf parameter. */
dbc16db1e58da6c Al Viro 2006-11-20 3028 static __be16 sctp_process_asconf_param(struct sctp_association *asoc,
^1da177e4c3f415 Linus Torvalds 2005-04-16 3029 struct sctp_chunk *asconf,
8b32f2348a0441e Xin Long 2017-08-03 3030 struct sctp_addip_param *asconf_param)
^1da177e4c3f415 Linus Torvalds 2005-04-16 3031 {
327c0dab8d1301c Xin Long 2017-08-11 3032 union sctp_addr_param *addr_param;
^1da177e4c3f415 Linus Torvalds 2005-04-16 3033 struct sctp_transport *peer;
^1da177e4c3f415 Linus Torvalds 2005-04-16 3034 union sctp_addr addr;
327c0dab8d1301c Xin Long 2017-08-11 3035 struct sctp_af *af;
^1da177e4c3f415 Linus Torvalds 2005-04-16 3036
8b32f2348a0441e Xin Long 2017-08-03 3037 addr_param = (void *)asconf_param + sizeof(*asconf_param);
c1cc678adaa78ae Patrick McHardy 2008-05-13 3038
44e65c1ef1e771b Wei Yongjun 2009-06-16 3039 if (asconf_param->param_hdr.type != SCTP_PARAM_ADD_IP &&
44e65c1ef1e771b Wei Yongjun 2009-06-16 3040 asconf_param->param_hdr.type != SCTP_PARAM_DEL_IP &&
44e65c1ef1e771b Wei Yongjun 2009-06-16 3041 asconf_param->param_hdr.type != SCTP_PARAM_SET_PRIMARY)
44e65c1ef1e771b Wei Yongjun 2009-06-16 3042 return SCTP_ERROR_UNKNOWN_PARAM;
44e65c1ef1e771b Wei Yongjun 2009-06-16 3043
6a435732accd9e3 Shan Wei 2011-04-18 3044 switch (addr_param->p.type) {
c4492586a618d18 Wei Yongjun 2008-05-09 3045 case SCTP_PARAM_IPV6_ADDRESS:
c4492586a618d18 Wei Yongjun 2008-05-09 3046 if (!asoc->peer.ipv6_address)
945e5abceef8bdb Wei Yongjun 2009-04-16 3047 return SCTP_ERROR_DNS_FAILED;
c4492586a618d18 Wei Yongjun 2008-05-09 3048 break;
c4492586a618d18 Wei Yongjun 2008-05-09 3049 case SCTP_PARAM_IPV4_ADDRESS:
c4492586a618d18 Wei Yongjun 2008-05-09 3050 if (!asoc->peer.ipv4_address)
945e5abceef8bdb Wei Yongjun 2009-04-16 3051 return SCTP_ERROR_DNS_FAILED;
c4492586a618d18 Wei Yongjun 2008-05-09 3052 break;
c4492586a618d18 Wei Yongjun 2008-05-09 3053 default:
945e5abceef8bdb Wei Yongjun 2009-04-16 3054 return SCTP_ERROR_DNS_FAILED;
c4492586a618d18 Wei Yongjun 2008-05-09 3055 }
c4492586a618d18 Wei Yongjun 2008-05-09 3056
6a435732accd9e3 Shan Wei 2011-04-18 3057 af = sctp_get_af_specific(param_type2af(addr_param->p.type));
^1da177e4c3f415 Linus Torvalds 2005-04-16 3058 if (unlikely(!af))
945e5abceef8bdb Wei Yongjun 2009-04-16 3059 return SCTP_ERROR_DNS_FAILED;
^1da177e4c3f415 Linus Torvalds 2005-04-16 3060
dd86d136f9feb72 Al Viro 2006-11-20 3061 af->from_addr_param(&addr, addr_param, htons(asoc->peer.port), 0);
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3062
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3063 /* ADDIP 4.2.1 This parameter MUST NOT contain a broadcast
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3064 * or multicast address.
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3065 * (note: wildcard is permitted and requires special handling so
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3066 * make sure we check for that)
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3067 */
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3068 if (!af->is_any(&addr) && !af->addr_valid(&addr, NULL, asconf->skb))
945e5abceef8bdb Wei Yongjun 2009-04-16 3069 return SCTP_ERROR_DNS_FAILED;
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3070
^1da177e4c3f415 Linus Torvalds 2005-04-16 3071 switch (asconf_param->param_hdr.type) {
^1da177e4c3f415 Linus Torvalds 2005-04-16 3072 case SCTP_PARAM_ADD_IP:
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3073 /* Section 4.2.1:
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3074 * If the address 0.0.0.0 or ::0 is provided, the source
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3075 * address of the packet MUST be added.
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3076 */
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3077 if (af->is_any(&addr))
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3078 memcpy(&addr, &asconf->source, sizeof(addr));
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3079
2277c7cd75e3978 Richard Haines 2018-02-13 3080 if (security_sctp_bind_connect(asoc->ep->base.sk,
2277c7cd75e3978 Richard Haines 2018-02-13 3081 SCTP_PARAM_ADD_IP,
2277c7cd75e3978 Richard Haines 2018-02-13 3082 (struct sockaddr *)&addr,
2277c7cd75e3978 Richard Haines 2018-02-13 3083 af->sockaddr_len))
2277c7cd75e3978 Richard Haines 2018-02-13 3084 return SCTP_ERROR_REQ_REFUSED;
2277c7cd75e3978 Richard Haines 2018-02-13 3085
^1da177e4c3f415 Linus Torvalds 2005-04-16 3086 /* ADDIP 4.3 D9) If an endpoint receives an ADD IP address
^1da177e4c3f415 Linus Torvalds 2005-04-16 3087 * request and does not have the local resources to add this
^1da177e4c3f415 Linus Torvalds 2005-04-16 3088 * new address to the association, it MUST return an Error
^1da177e4c3f415 Linus Torvalds 2005-04-16 3089 * Cause TLV set to the new error code 'Operation Refused
^1da177e4c3f415 Linus Torvalds 2005-04-16 3090 * Due to Resource Shortage'.
^1da177e4c3f415 Linus Torvalds 2005-04-16 3091 */
^1da177e4c3f415 Linus Torvalds 2005-04-16 3092
dd86d136f9feb72 Al Viro 2006-11-20 3093 peer = sctp_assoc_add_peer(asoc, &addr, GFP_ATOMIC, SCTP_UNCONFIRMED);
^1da177e4c3f415 Linus Torvalds 2005-04-16 3094 if (!peer)
^1da177e4c3f415 Linus Torvalds 2005-04-16 3095 return SCTP_ERROR_RSRC_LOW;
^1da177e4c3f415 Linus Torvalds 2005-04-16 3096
^1da177e4c3f415 Linus Torvalds 2005-04-16 3097 /* Start the heartbeat timer. */
ba6f5e33bdbb9ed Marcelo Ricardo Leitner 2016-04-06 3098 sctp_transport_reset_hb_timer(peer);
6af29ccc223b0fe Michio Honda 2011-06-16 3099 asoc->new_transport = peer;
^1da177e4c3f415 Linus Torvalds 2005-04-16 3100 break;
^1da177e4c3f415 Linus Torvalds 2005-04-16 3101 case SCTP_PARAM_DEL_IP:
^1da177e4c3f415 Linus Torvalds 2005-04-16 3102 /* ADDIP 4.3 D7) If a request is received to delete the
^1da177e4c3f415 Linus Torvalds 2005-04-16 3103 * last remaining IP address of a peer endpoint, the receiver
^1da177e4c3f415 Linus Torvalds 2005-04-16 3104 * MUST send an Error Cause TLV with the error cause set to the
^1da177e4c3f415 Linus Torvalds 2005-04-16 3105 * new error code 'Request to Delete Last Remaining IP Address'.
^1da177e4c3f415 Linus Torvalds 2005-04-16 3106 */
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3107 if (asoc->peer.transport_count == 1)
^1da177e4c3f415 Linus Torvalds 2005-04-16 3108 return SCTP_ERROR_DEL_LAST_IP;
^1da177e4c3f415 Linus Torvalds 2005-04-16 3109
^1da177e4c3f415 Linus Torvalds 2005-04-16 3110 /* ADDIP 4.3 D8) If a request is received to delete an IP
^1da177e4c3f415 Linus Torvalds 2005-04-16 3111 * address which is also the source address of the IP packet
^1da177e4c3f415 Linus Torvalds 2005-04-16 3112 * which contained the ASCONF chunk, the receiver MUST reject
^1da177e4c3f415 Linus Torvalds 2005-04-16 3113 * this request. To reject the request the receiver MUST send
^1da177e4c3f415 Linus Torvalds 2005-04-16 3114 * an Error Cause TLV set to the new error code 'Request to
^1da177e4c3f415 Linus Torvalds 2005-04-16 3115 * Delete Source IP Address'
^1da177e4c3f415 Linus Torvalds 2005-04-16 3116 */
b1364104e37c9d8 Michio Honda 2011-04-26 3117 if (sctp_cmp_addr_exact(&asconf->source, &addr))
^1da177e4c3f415 Linus Torvalds 2005-04-16 3118 return SCTP_ERROR_DEL_SRC_IP;
^1da177e4c3f415 Linus Torvalds 2005-04-16 3119
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3120 /* Section 4.2.2
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3121 * If the address 0.0.0.0 or ::0 is provided, all
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3122 * addresses of the peer except the source address of the
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3123 * packet MUST be deleted.
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3124 */
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3125 if (af->is_any(&addr)) {
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3126 sctp_assoc_set_primary(asoc, asconf->transport);
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3127 sctp_assoc_del_nonprimary_peers(asoc,
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3128 asconf->transport);
7c5a9461812b21e lucien 2015-08-28 3129 return SCTP_ERROR_NO_ERROR;
7c5a9461812b21e lucien 2015-08-28 3130 }
7c5a9461812b21e lucien 2015-08-28 3131
7c5a9461812b21e lucien 2015-08-28 3132 /* If the address is not part of the association, the
7c5a9461812b21e lucien 2015-08-28 3133 * ASCONF-ACK with Error Cause Indication Parameter
7c5a9461812b21e lucien 2015-08-28 3134 * which including cause of Unresolvable Address should
7c5a9461812b21e lucien 2015-08-28 3135 * be sent.
7c5a9461812b21e lucien 2015-08-28 3136 */
7c5a9461812b21e lucien 2015-08-28 3137 peer = sctp_assoc_lookup_paddr(asoc, &addr);
7c5a9461812b21e lucien 2015-08-28 3138 if (!peer)
7c5a9461812b21e lucien 2015-08-28 3139 return SCTP_ERROR_DNS_FAILED;
7c5a9461812b21e lucien 2015-08-28 3140
7c5a9461812b21e lucien 2015-08-28 3141 sctp_assoc_rm_peer(asoc, peer);
^1da177e4c3f415 Linus Torvalds 2005-04-16 3142 break;
^1da177e4c3f415 Linus Torvalds 2005-04-16 3143 case SCTP_PARAM_SET_PRIMARY:
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3144 /* ADDIP Section 4.2.4
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3145 * If the address 0.0.0.0 or ::0 is provided, the receiver
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3146 * MAY mark the source address of the packet as its
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3147 * primary.
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3148 */
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3149 if (af->is_any(&addr))
42e30bf3463cd37 Vlad Yasevich 2007-12-20 @3150 memcpy(&addr.v4, sctp_source(asconf), sizeof(addr));
42e30bf3463cd37 Vlad Yasevich 2007-12-20 3151
2277c7cd75e3978 Richard Haines 2018-02-13 3152 if (security_sctp_bind_connect(asoc->ep->base.sk,
2277c7cd75e3978 Richard Haines 2018-02-13 3153 SCTP_PARAM_SET_PRIMARY,
2277c7cd75e3978 Richard Haines 2018-02-13 3154 (struct sockaddr *)&addr,
2277c7cd75e3978 Richard Haines 2018-02-13 3155 af->sockaddr_len))
2277c7cd75e3978 Richard Haines 2018-02-13 3156 return SCTP_ERROR_REQ_REFUSED;
2277c7cd75e3978 Richard Haines 2018-02-13 3157
dd86d136f9feb72 Al Viro 2006-11-20 3158 peer = sctp_assoc_lookup_paddr(asoc, &addr);
^1da177e4c3f415 Linus Torvalds 2005-04-16 3159 if (!peer)
945e5abceef8bdb Wei Yongjun 2009-04-16 3160 return SCTP_ERROR_DNS_FAILED;
^1da177e4c3f415 Linus Torvalds 2005-04-16 3161
^1da177e4c3f415 Linus Torvalds 2005-04-16 3162 sctp_assoc_set_primary(asoc, peer);
^1da177e4c3f415 Linus Torvalds 2005-04-16 3163 break;
^1da177e4c3f415 Linus Torvalds 2005-04-16 3164 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 3165
^1da177e4c3f415 Linus Torvalds 2005-04-16 3166 return SCTP_ERROR_NO_ERROR;
^1da177e4c3f415 Linus Torvalds 2005-04-16 3167 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 3168
:::::: The code at line 3150 was first introduced by commit
:::::: 42e30bf3463cd37d73839376662cb79b4d5c416c [SCTP]: Handle the wildcard ADD-IP Address parameter
:::::: TO: Vlad Yasevich <vladislav.yasevich(a)hp.com>
:::::: CC: David S. Miller <davem(a)davemloft.net>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 5 months