Re: [PATCH] staging: andriod: ashmem: Declared file operation with const keyword
On Sat, Mar 13, 2021 at 10:57 PM namratajanawade wrote: > > Warning found by checkpatch.pl script. That doesn't tell what you did or why you did it. Please write an appropriate commit description and resend the patch. karthik
[PATCH] staging: greybus: audio_helper.c: Replace strlcpy() with strscpy()
In gbaudio_remove_controls() , replace the usage of strlcpy() with strscpy() because strlcpy() only limits the *destination* size, and the source is always read fully. https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=v6a6g1ouzcprm...@mail.gmail.com/ was quoted by checkpatch while showing this warning. Signed-off-by: B K Karthik --- drivers/staging/greybus/audio_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/greybus/audio_helper.c b/drivers/staging/greybus/audio_helper.c index 3011b8abce38..1ed4772d2771 100644 --- a/drivers/staging/greybus/audio_helper.c +++ b/drivers/staging/greybus/audio_helper.c @@ -166,7 +166,7 @@ static int gbaudio_remove_controls(struct snd_card *card, struct device *dev, snprintf(id.name, sizeof(id.name), "%s %s", prefix, control->name); else - strlcpy(id.name, control->name, sizeof(id.name)); + strscpy(id.name, control->name, sizeof(id.name)); id.numid = 0; id.iface = control->iface; id.device = control->device; -- 2.17.1 signature.asc Description: PGP signature
Re: KASAN: use-after-free Read in __xfrm6_tunnel_spi_lookup
On Thu, Sep 10, 2020 at 1:32 PM Dmitry Vyukov wrote: > > On Thu, Sep 10, 2020 at 9:20 AM Anant Thazhemadam > wrote: > > Looks like this bug is no longer valid. I'm not sure which commit seems to > > have fixed it. Can this be marked as invalid or closed yet? > > You can see on the dashboard (or in mailing list archives) that B K > Karthik tested a patch for this bug in July: > https://syzkaller.appspot.com/bug?extid=72ff2fa98097767b5a27 > > So perhaps that patch fixes it? Karthik, did you send it? Was it > merged? Did the commit include the syzbot Reported-by tag? > I did send it. I was taking a u32 spi value and casting it to a pointer to an IP address. Steffen Klassert pointed out to me that the approach i was looking at was completely wrong. https://lkml.org/lkml/2020/7/27/361 is the conversation. hope this helps. thanks, karthik > > > On Thu, Jul 16, 2020 at 4:05 AM syzbot > wrote: > > > > syzbot has found a reproducer for the following issue on: > > > > HEAD commit:ca0e494a Add linux-next specific files for 20200715 > > git tree: linux-next > > console output: https://syzkaller.appspot.com/x/log.txt?x=175099bf10 > > kernel config: https://syzkaller.appspot.com/x/.config?x=2c76d72659687242 > > dashboard link: https://syzkaller.appspot.com/bug?extid=72ff2fa98097767b5a27 > > compiler: gcc (GCC) 10.1.0-syz 20200507 > > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=112e8dbf10 > > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=109429bf10 > > > > IMPORTANT: if you fix the issue, please add the following tag to the commit: > > Reported-by: syzbot+72ff2fa98097767b5...@syzkaller.appspotmail.com > > > > netdevsim netdevsim0 netdevsim1: set [1, 0] type 2 family 0 port 6081 - 0 > > netdevsim netdevsim0 netdevsim2: set [1, 0] type 2 family 0 port 6081 - 0 > > netdevsim netdevsim0 netdevsim3: set [1, 0] type 2 family 0 port 6081 - 0 > > == > > BUG: KASAN: use-after-free in __xfrm6_tunnel_spi_lookup+0x3a9/0x3b0 > > net/ipv6/xfrm6_tunnel.c:79 > > Read of size 8 at addr 8880934578a8 by task syz-executor437/6811 > > CPU: 0 PID: 6811 Comm: syz-executor437 Not tainted > > 5.8.0-rc5-next-20200715-syzkaller #0 > > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS > > Google 01/01/2011 > > Call Trace: > > __dump_stack lib/dump_stack.c:77 [inline] > > dump_stack+0x18f/0x20d lib/dump_stack.c:118 > > print_address_description.constprop.0.cold+0xae/0x497 mm/kasan/report.c:383 > > __kasan_report mm/kasan/report.c:513 [inline] > > kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530 > > __xfrm6_tunnel_spi_lookup+0x3a9/0x3b0 net/ipv6/xfrm6_tunnel.c:79 > > xfrm6_tunnel_spi_lookup+0x8a/0x1d0 net/ipv6/xfrm6_tunnel.c:95 > > xfrmi6_rcv_tunnel+0xb9/0x100 net/xfrm/xfrm_interface.c:824 > > tunnel6_rcv+0xef/0x2b0 net/ipv6/tunnel6.c:148 > > ip6_protocol_deliver_rcu+0x2e8/0x1670 net/ipv6/ip6_input.c:433 > > ip6_input_finish+0x7f/0x160 net/ipv6/ip6_input.c:474 > > NF_HOOK include/linux/netfilter.h:307 [inline] > > NF_HOOK include/linux/netfilter.h:301 [inline] > > ip6_input+0x9c/0xd0 net/ipv6/ip6_input.c:483 > > dst_input include/net/dst.h:449 [inline] > > ip6_rcv_finish net/ipv6/ip6_input.c:76 [inline] > > NF_HOOK include/linux/netfilter.h:307 [inline] > > NF_HOOK include/linux/netfilter.h:301 [inline] > > ipv6_rcv+0x28e/0x3c0 net/ipv6/ip6_input.c:307 > > __netif_receive_skb_one_core+0x114/0x180 net/core/dev.c:5287 > > __netif_receive_skb+0x27/0x1c0 net/core/dev.c:5401 > > netif_receive_skb_internal net/core/dev.c:5503 [inline] > > netif_receive_skb+0x159/0x990 net/core/dev.c:5562 > > tun_rx_batched.isra.0+0x460/0x720 drivers/net/tun.c:1518 > > tun_get_user+0x23b2/0x35b0 drivers/net/tun.c:1972 > > tun_chr_write_iter+0xba/0x151 drivers/net/tun.c:2001 > > call_write_iter include/linux/fs.h:1879 [inline] > > new_sync_write+0x422/0x650 fs/read_write.c:515 > > vfs_write+0x59d/0x6b0 fs/read_write.c:595 > > ksys_write+0x12d/0x250 fs/read_write.c:648 > > do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:384 > > entry_SYSCALL_64_after_hwframe+0x44/0xa9 > > RIP: 0033:0x403d50 > > Code: Bad RIP value. > > RSP: 002b:7ffe8fe93368 EFLAGS: 0246 ORIG_RAX: 0001 > > RAX: ffda RBX: 0003 RCX: 00403d50 > > RDX: 005e RSI: 27c0 RDI: 00f0 > > RBP: 7ffe8fe93390 R08: R09: > > R10: R11: 0246
Re: [PATCH v2] tty: serial: fsl_lpuart.c: prevent a bad shift operation
On Wed, Aug 5, 2020 at 6:26 PM Greg Kroah-Hartman wrote: > > On Wed, Aug 05, 2020 at 12:09:34PM +, Vabhav Sharma (OSS) wrote: > > > > > > > -Original Message- > > > From: Greg Kroah-Hartman > > > Sent: Wednesday, July 29, 2020 9:34 PM > > > To: B K Karthik > > > Cc: Jiri Slaby ; linux-ser...@vger.kernel.org; > > > linux- > > > ker...@vger.kernel.org; Vabhav Sharma (OSS) > > > ; bhuvanchandra...@toradex.com > > > Subject: Re: [PATCH v2] tty: serial: fsl_lpuart.c: prevent a bad shift > > > operation > > > > > > On Tue, Jul 21, 2020 at 11:12:29PM +0530, B K Karthik wrote: > > > > prevent a bad shift operation by verifying that the argument to fls is > > > > non zero. > > > > > > > > Reported-by: "Vabhav Sharma (OSS)" > > > > Signed-off-by: B K Karthik > > > > --- > > > > v1 -> v2: > > > > added Reported-by tag > > > > > > > > drivers/tty/serial/fsl_lpuart.c | 3 ++- > > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > > > diff --git a/drivers/tty/serial/fsl_lpuart.c > > > > b/drivers/tty/serial/fsl_lpuart.c index 7ca642249224..0cc64279cd2d > > > > 100644 > > > > --- a/drivers/tty/serial/fsl_lpuart.c > > > > +++ b/drivers/tty/serial/fsl_lpuart.c > > > > @@ -1168,7 +1168,8 @@ static inline int lpuart_start_rx_dma(struct > > > lpuart_port *sport) > > > >* 10ms at any baud rate. > > > >*/ > > > > sport->rx_dma_rng_buf_len = (DMA_RX_TIMEOUT * baud / bits / > > > 1000) * 2; > > > > - sport->rx_dma_rng_buf_len = (1 << (fls(sport->rx_dma_rng_buf_len) > > > - 1)); > > > > + if (sport->rx_dma_rng_buf_len != 0) > > > > > > How can this variable become 0? > > Condition x, taking false branch > > Explicitly returning zero > > > > static __always_inline int fls(unsigned int x) > > { > > return x ? sizeof(x) * 8 - __builtin_clz(x) : 0; > > } > > What false branch? I'm assuming he's talking about the value after : in the ? operator. I am checking for the wrong thing in the if statement. We will have to check for the return value of fls() before performing the shift. I can change it and send a v3 if you agree. Please let me know. thanks, karthik
Re: [PATCH] net: tipc: fix general protection fault in tipc_conn_delete_sub
On Mon, Jul 27, 2020 at 6:53 PM Greg KH wrote: > > On Mon, Jul 27, 2020 at 06:40:57PM +0530, B K Karthik wrote: > > fix a general protection fault in tipc_conn_delete_sub > > by checking for the existance of con->server. > > prevent a null-ptr-deref by returning -EINVAL when > > con->server is NULL > > > > general protection fault, probably for non-canonical address > > 0xdc14: [#1] PREEMPT SMP KASAN > > KASAN: null-ptr-deref in range [0x00a0-0x00a7] > > CPU: 1 PID: 113 Comm: kworker/u4:3 Not tainted 5.6.0-syzkaller #0 > > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS > > Google 01/01/2011 > > Workqueue: tipc_send tipc_conn_send_work > > RIP: 0010:tipc_conn_delete_sub+0x54/0x440 net/tipc/topsrv.c:231 > > Code: 48 c1 ea 03 80 3c 02 00 0f 85 f0 03 00 00 48 b8 00 00 00 00 00 fc ff > > df 48 8b 6b 18 48 8d bd a0 00 00 00 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f > > 85 c0 03 00 00 48 c7 c0 34 0b 8a 8a 4c 8b a5 a0 00 > > RSP: 0018:c900012d7b58 EFLAGS: 00010206 > > RAX: dc00 RBX: 8880a8269c00 RCX: 8789ca01 > > RDX: 0014 RSI: 8789a059 RDI: 00a0 > > RBP: R08: 8880a8d88380 R09: fbfff18577a8 > > R10: fbfff18577a7 R11: 8c2bbd3f R12: dc00 > > R13: 888093d35a18 R14: 8880a8269c00 R15: 888093d35a00 > > FS: () GS:8880ae70() knlGS: > > CS: 0010 DS: ES: CR0: 80050033 > > CR2: 0076c000 CR3: 9441d000 CR4: 001406e0 > > DR0: DR1: DR2: > > DR3: DR6: fffe0ff0 DR7: 0400 > > Call Trace: > > tipc_conn_send_to_sock+0x380/0x560 net/tipc/topsrv.c:266 > > tipc_conn_send_work+0x6f/0x90 net/tipc/topsrv.c:304 > > process_one_work+0x965/0x16a0 kernel/workqueue.c:2266 > > worker_thread+0x96/0xe20 kernel/workqueue.c:2412 > > kthread+0x388/0x470 kernel/kthread.c:268 > > ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352 > > Modules linked in: > > ---[ end trace 2c161a84be832606 ]--- > > RIP: 0010:tipc_conn_delete_sub+0x54/0x440 net/tipc/topsrv.c:231 > > Code: 48 c1 ea 03 80 3c 02 00 0f 85 f0 03 00 00 48 b8 00 00 00 00 00 fc ff > > df 48 8b 6b 18 48 8d bd a0 00 00 00 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f > > 85 c0 03 00 00 48 c7 c0 34 0b 8a 8a 4c 8b a5 a0 00 > > RSP: 0018:c900012d7b58 EFLAGS: 00010206 > > RAX: dc00 RBX: 8880a8269c00 RCX: 8789ca01 > > RDX: 0014 RSI: 8789a059 RDI: 00a0 > > RBP: R08: 8880a8d88380 R09: fbfff18577a8 > > R10: fbfff18577a7 R11: 8c2bbd3f R12: dc00 > > R13: 888093d35a18 R14: 8880a8269c00 R15: 888093d35a00 > > FS: () GS:8880ae70() knlGS: > > CS: 0010 DS: ES: CR0: 80050033 > > CR2: 2080 CR3: 91b8e000 CR4: 001406e0 > > DR0: DR1: DR2: > > DR3: DR6: fffe0ff0 DR7: 0400 > > > > Reported-and-tested-by: > > syzbot+55a38037455d0351e...@syzkaller.appspotmail.com > > Signed-off-by: B K Karthik > > --- > > net/tipc/topsrv.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/net/tipc/topsrv.c b/net/tipc/topsrv.c > > index 1489cfb941d8..6c8d0c6bb112 100644 > > --- a/net/tipc/topsrv.c > > +++ b/net/tipc/topsrv.c > > @@ -255,6 +255,9 @@ static void tipc_conn_send_to_sock(struct tipc_conn > > *con) > > int count = 0; > > int ret; > > > > + if (!con->server) > > + return -EINVAL; > > What is wrong with looking at the srv local variable instead? > > And how is server getting set to NULL and this function still being > called? tipc_conn_send_work makes a call to connected() which just returns con && test_bit(CF_CONNECTED, >flags) maybe we can add this check to the implementation of connection() if you agree, but I found this solution to be fairly simpler because I'm not sure where else connected() is being used, and I did not want to introduce redundant function calls. Yes we can replace con->server with the local variable srv. Extremely sorry, I hadn't noticed it earlier. please let me know if i've wrongly understood any of these. thanks, karthik
[PATCH] net: tipc: fix general protection fault in tipc_conn_delete_sub
fix a general protection fault in tipc_conn_delete_sub by checking for the existance of con->server. prevent a null-ptr-deref by returning -EINVAL when con->server is NULL general protection fault, probably for non-canonical address 0xdc14: [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x00a0-0x00a7] CPU: 1 PID: 113 Comm: kworker/u4:3 Not tainted 5.6.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: tipc_send tipc_conn_send_work RIP: 0010:tipc_conn_delete_sub+0x54/0x440 net/tipc/topsrv.c:231 Code: 48 c1 ea 03 80 3c 02 00 0f 85 f0 03 00 00 48 b8 00 00 00 00 00 fc ff df 48 8b 6b 18 48 8d bd a0 00 00 00 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 c0 03 00 00 48 c7 c0 34 0b 8a 8a 4c 8b a5 a0 00 RSP: 0018:c900012d7b58 EFLAGS: 00010206 RAX: dc00 RBX: 8880a8269c00 RCX: 8789ca01 RDX: 0014 RSI: 8789a059 RDI: 00a0 RBP: R08: 8880a8d88380 R09: fbfff18577a8 R10: fbfff18577a7 R11: 8c2bbd3f R12: dc00 R13: 888093d35a18 R14: 8880a8269c00 R15: 888093d35a00 FS: () GS:8880ae70() knlGS: CS: 0010 DS: ES: CR0: 80050033 CR2: 0076c000 CR3: 9441d000 CR4: 001406e0 DR0: DR1: DR2: DR3: DR6: fffe0ff0 DR7: 0400 Call Trace: tipc_conn_send_to_sock+0x380/0x560 net/tipc/topsrv.c:266 tipc_conn_send_work+0x6f/0x90 net/tipc/topsrv.c:304 process_one_work+0x965/0x16a0 kernel/workqueue.c:2266 worker_thread+0x96/0xe20 kernel/workqueue.c:2412 kthread+0x388/0x470 kernel/kthread.c:268 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352 Modules linked in: ---[ end trace 2c161a84be832606 ]--- RIP: 0010:tipc_conn_delete_sub+0x54/0x440 net/tipc/topsrv.c:231 Code: 48 c1 ea 03 80 3c 02 00 0f 85 f0 03 00 00 48 b8 00 00 00 00 00 fc ff df 48 8b 6b 18 48 8d bd a0 00 00 00 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 c0 03 00 00 48 c7 c0 34 0b 8a 8a 4c 8b a5 a0 00 RSP: 0018:c900012d7b58 EFLAGS: 00010206 RAX: dc00 RBX: 8880a8269c00 RCX: 8789ca01 RDX: 0014 RSI: 8789a059 RDI: 00a0 RBP: R08: 8880a8d88380 R09: fbfff18577a8 R10: fbfff18577a7 R11: 8c2bbd3f R12: dc00 R13: 888093d35a18 R14: 8880a8269c00 R15: 888093d35a00 FS: () GS:8880ae70() knlGS: CS: 0010 DS: ES: CR0: 80050033 CR2: 2080 CR3: 91b8e000 CR4: 001406e0 DR0: DR1: DR2: DR3: DR6: fffe0ff0 DR7: 0400 Reported-and-tested-by: syzbot+55a38037455d0351e...@syzkaller.appspotmail.com Signed-off-by: B K Karthik --- net/tipc/topsrv.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/tipc/topsrv.c b/net/tipc/topsrv.c index 1489cfb941d8..6c8d0c6bb112 100644 --- a/net/tipc/topsrv.c +++ b/net/tipc/topsrv.c @@ -255,6 +255,9 @@ static void tipc_conn_send_to_sock(struct tipc_conn *con) int count = 0; int ret; + if (!con->server) + return -EINVAL; + spin_lock_bh(>outqueue_lock); while (!list_empty(queue)) { -- 2.20.1 signature.asc Description: PGP signature
Re: [PATCH v2] net: ipv6: fix use-after-free Read in __xfrm6_tunnel_spi_lookup
On Mon, Jul 27, 2020 at 1:37 AM Cong Wang wrote: > > On Sat, Jul 25, 2020 at 11:12 PM B K Karthik wrote: > > > > On Sun, Jul 26, 2020 at 11:05 AM Cong Wang wrote: > > > > > > On Sat, Jul 25, 2020 at 8:09 PM B K Karthik > > > wrote: > > > > @@ -103,10 +103,10 @@ static int __xfrm6_tunnel_spi_check(struct net > > > > *net, u32 spi) > > > > { > > > > struct xfrm6_tunnel_net *xfrm6_tn = xfrm6_tunnel_pernet(net); > > > > struct xfrm6_tunnel_spi *x6spi; > > > > - int index = xfrm6_tunnel_spi_hash_byspi(spi); > > > > + int index = xfrm6_tunnel_spi_hash_byaddr((const xfrm_address_t > > > > *)spi); > > > > > > > > hlist_for_each_entry(x6spi, > > > > -_tn->spi_byspi[index], > > > > +_tn->spi_byaddr[index], > > > > list_byspi) { > > > > if (x6spi->spi == spi) > > > > > > How did you convince yourself this is correct? This lookup is still > > > using spi. :) > > > > I'm sorry, but my intention behind writing this patch was not to fix > > the UAF, but to fix a slab-out-of-bound. > > Odd, your $subject is clearly UAF, so is the stack trace in your changelog. > :) > > > > If required, I can definitely change the subject line and resend the > > patch, but I figured this was correct for > > https://syzkaller.appspot.com/bug?id=058d05f470583ab2843b1d6785fa8d0658ef66ae > > . since that particular report did not have a reproducer, > > Dmitry Vyukov suggested that I test this patch on > > other reports for xfrm/spi . > > You have to change it to avoid misleading. I will do that once somebody tells me this patch is reasonable to avoid wasting people's time. > > > > > Forgive me if this was the wrong way to send a patch for that > > particular report, but I guessed since the reproducer did not trigger > > the crash > > for UAF, I would leave the subject line as 'fix UAF' :) > > > > xfrm6_spi_hash_by_hash seemed more convincing because I had to prevent > > a slab-out-of-bounds because it uses ipv6_addr_hash. > > It would be of great help if you could help me understand how this was > > able to fix a UAF. > > Sure, you just avoid a pointer deref, which of course can fix the UAF, > but I still don't think it is correct in any aspect. I saw a function call being made to tomoyo_check_acl(). the next thing happening is a kfree(). Also, spi_hash_byspi just returns spi % XFRM6_TUNNEL_SPI_BYSPI_HSIZE . I'm a mentee, hence I would say my knowledge is very limited, please let me know if I am making a horrible mistake somewhere, but return (__force u32)(a->s6_addr32[0] ^ a->s6_addr32[1] ^ a->s6_addr32[2] ^ a->s6_addr32[3]); seems like a better because as David S. Miller said "It is doing a XOR on all bits of an IPv6 address, it is doing more bit shifting which the existing hash was ignoring" . Please help me understand this better if I am going wrong. > > Even if it is a OOB, you still have to explain why it happened. Once > again, I can't see how it could happen either. > > > > > > > > > More importantly, can you explain how UAF happens? Apparently > > > the syzbot stack traces you quote make no sense at all. I also > > > looked at other similar reports, none of them makes sense to me. > > > > Forgive me, but I do not understand what you mean by the stack traces > > (this or other similar reports) "make no sense". > > Because the stack trace in your changelog clearly shows it is allocated > in tomoyo_init_log(), which is a buffer in struct tomoyo_query, but > none of xfrm paths uses it. Or do you see anything otherwise? Aren't there indirect inet calls and netfilter hooks? I'm sorry I do not see anything otherwise. Please help me understand. thanks, karthik
Re: [PATCH v2] net: ipv6: fix use-after-free Read in __xfrm6_tunnel_spi_lookup
On Sun, Jul 26, 2020 at 11:05 AM Cong Wang wrote: > > On Sat, Jul 25, 2020 at 8:09 PM B K Karthik wrote: > > @@ -103,10 +103,10 @@ static int __xfrm6_tunnel_spi_check(struct net *net, > > u32 spi) > > { > > struct xfrm6_tunnel_net *xfrm6_tn = xfrm6_tunnel_pernet(net); > > struct xfrm6_tunnel_spi *x6spi; > > - int index = xfrm6_tunnel_spi_hash_byspi(spi); > > + int index = xfrm6_tunnel_spi_hash_byaddr((const xfrm_address_t > > *)spi); > > > > hlist_for_each_entry(x6spi, > > -_tn->spi_byspi[index], > > +_tn->spi_byaddr[index], > > list_byspi) { > > if (x6spi->spi == spi) > > How did you convince yourself this is correct? This lookup is still > using spi. :) I'm sorry, but my intention behind writing this patch was not to fix the UAF, but to fix a slab-out-of-bound. If required, I can definitely change the subject line and resend the patch, but I figured this was correct for https://syzkaller.appspot.com/bug?id=058d05f470583ab2843b1d6785fa8d0658ef66ae . since that particular report did not have a reproducer, Dmitry Vyukov suggested that I test this patch on other reports for xfrm/spi . Forgive me if this was the wrong way to send a patch for that particular report, but I guessed since the reproducer did not trigger the crash for UAF, I would leave the subject line as 'fix UAF' :) xfrm6_spi_hash_by_hash seemed more convincing because I had to prevent a slab-out-of-bounds because it uses ipv6_addr_hash. It would be of great help if you could help me understand how this was able to fix a UAF. > > More importantly, can you explain how UAF happens? Apparently > the syzbot stack traces you quote make no sense at all. I also > looked at other similar reports, none of them makes sense to me. Forgive me, but I do not understand what you mean by the stack traces (this or other similar reports) "make no sense". I apologise if this message was hurtful / disrespectful in any manner. thanks, karthik
[PATCH v2] net: ipv6: fix use-after-free Read in __xfrm6_tunnel_spi_lookup
) raw: 00fffe000200 ea00028d4308 ea0002834c88 8880aa000600 raw: 888093457000 00010004 page dumped because: kasan: bad access detected Memory state around the buggy address: 888093457780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc 888093457800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >888093457880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ 888093457900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb 888093457980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb == Reported-and-tested-by: syzbot+72ff2fa98097767b5...@syzkaller.appspotmail.com Reported-by: kernel test robot Signed-off-by: B K Karthik --- v1 -> v2: added cast in arguement from u32 to (const xfrm_address_t *) added Reported-by: kernel test robot removed Reported-by: syzbot+72ff2fa98097767b5...@syzkaller.appspotmail.com added Reported-and-tested-by: syzbot+72ff2fa98097767b5...@syzkaller.appspotmail.com net/ipv6/xfrm6_tunnel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c index 25b7ebda2fab..a0e18be2145f 100644 --- a/net/ipv6/xfrm6_tunnel.c +++ b/net/ipv6/xfrm6_tunnel.c @@ -103,10 +103,10 @@ static int __xfrm6_tunnel_spi_check(struct net *net, u32 spi) { struct xfrm6_tunnel_net *xfrm6_tn = xfrm6_tunnel_pernet(net); struct xfrm6_tunnel_spi *x6spi; - int index = xfrm6_tunnel_spi_hash_byspi(spi); + int index = xfrm6_tunnel_spi_hash_byaddr((const xfrm_address_t *)spi); hlist_for_each_entry(x6spi, -_tn->spi_byspi[index], +_tn->spi_byaddr[index], list_byspi) { if (x6spi->spi == spi) return -1; -- 2.20.1 signature.asc Description: PGP signature
[PATCH] net: xfrm: xfrm_policy.c: remove some unnecessary cases in decode_session6
remove some unnecessary cases in decode_session6 Signed-off-by: B K Karthik --- net/xfrm/xfrm_policy.c | 4 1 file changed, 4 deletions(-) diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 19c5e0fa3f44..e1c988a89382 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -3449,10 +3449,6 @@ decode_session6(struct sk_buff *skb, struct flowi *fl, bool reverse) fl6->flowi6_proto = nexthdr; return; #endif - /* XXX Why are there these headers? */ - case IPPROTO_AH: - case IPPROTO_ESP: - case IPPROTO_COMP: default: fl6->fl6_ipsec_spi = 0; fl6->flowi6_proto = nexthdr; -- 2.20.1 signature.asc Description: PGP signature
[PATCH] net: ipv6: fix slab-out-of-bounds Read in __xfrm6_tunnel_spi_check
use spi_byaddr instead of spi_byspi == BUG: KASAN: slab-out-of-bounds in __xfrm6_tunnel_spi_check+0x316/0x330 net/ipv6/xfrm6_tunnel.c:108 Read of size 8 at addr 8880a93a5e08 by task syz-executor.1/8482 CPU: 0 PID: 8482 Comm: syz-executor.1 Not tainted 5.8.0-rc5-next-20200716-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x18f/0x20d lib/dump_stack.c:118 print_address_description.constprop.0.cold+0xae/0x497 mm/kasan/report.c:383 __kasan_report mm/kasan/report.c:513 [inline] kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530 __xfrm6_tunnel_spi_check+0x316/0x330 net/ipv6/xfrm6_tunnel.c:108 __xfrm6_tunnel_alloc_spi net/ipv6/xfrm6_tunnel.c:131 [inline] xfrm6_tunnel_alloc_spi+0x296/0x8a0 net/ipv6/xfrm6_tunnel.c:174 ipcomp6_tunnel_create net/ipv6/ipcomp6.c:84 [inline] ipcomp6_tunnel_attach net/ipv6/ipcomp6.c:124 [inline] ipcomp6_init_state net/ipv6/ipcomp6.c:159 [inline] ipcomp6_init_state+0x2af/0x700 net/ipv6/ipcomp6.c:139 __xfrm_init_state+0x9a6/0x14b0 net/xfrm/xfrm_state.c:2498 xfrm_init_state+0x1a/0x70 net/xfrm/xfrm_state.c:2525 pfkey_msg2xfrm_state net/key/af_key.c:1291 [inline] pfkey_add+0x1a10/0x2b70 net/key/af_key.c:1508 pfkey_process+0x66d/0x7a0 net/key/af_key.c:2834 pfkey_sendmsg+0x42d/0x800 net/key/af_key.c:3673 sock_sendmsg_nosec net/socket.c:651 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:671 sys_sendmsg+0x331/0x810 net/socket.c:2362 ___sys_sendmsg+0xf3/0x170 net/socket.c:2416 __sys_sendmmsg+0x195/0x480 net/socket.c:2506 __do_sys_sendmmsg net/socket.c:2535 [inline] __se_sys_sendmmsg net/socket.c:2532 [inline] __x64_sys_sendmmsg+0x99/0x100 net/socket.c:2532 do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:384 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x45c1d9 Code: Bad RIP value. RSP: 002b:7fe3fa739c78 EFLAGS: 0246 ORIG_RAX: 0133 RAX: ffda RBX: 00025a40 RCX: 0045c1d9 RDX: 04000282 RSI: 2180 RDI: 0003 RBP: 0078bf48 R08: R09: R10: R11: 0246 R12: 0078bf0c R13: 7fffec91896f R14: 7fe3fa73a9c0 R15: 0078bf0c Allocated by task 1: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48 kasan_set_track mm/kasan/common.c:56 [inline] __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:461 kmem_cache_alloc_trace+0x16e/0x2c0 mm/slab.c:3550 kmalloc include/linux/slab.h:554 [inline] kzalloc include/linux/slab.h:666 [inline] device_private_init drivers/base/core.c:2763 [inline] device_add+0x1008/0x1c40 drivers/base/core.c:2813 netdev_register_kobject+0x17d/0x3b0 net/core/net-sysfs.c:1888 register_netdevice+0xd29/0x1540 net/core/dev.c:9523 register_netdev+0x2d/0x50 net/core/dev.c:9654 ip6gre_init_net+0x3c4/0x5e0 net/ipv6/ip6_gre.c:1587 ops_init+0xaf/0x470 net/core/net_namespace.c:151 __register_pernet_operations net/core/net_namespace.c:1140 [inline] register_pernet_operations+0x35a/0x850 net/core/net_namespace.c:1217 register_pernet_device+0x26/0x70 net/core/net_namespace.c:1304 ip6gre_init+0x1f/0x132 net/ipv6/ip6_gre.c:2327 do_one_initcall+0x10a/0x7b0 init/main.c:1201 do_initcall_level init/main.c:1274 [inline] do_initcalls init/main.c:1290 [inline] do_basic_setup init/main.c:1310 [inline] kernel_init_freeable+0x4f4/0x5a3 init/main.c:1507 kernel_init+0xd/0x1c0 init/main.c:1401 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294 The buggy address belongs to the object at 8880a93a5c00 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 8 bytes to the right of 512-byte region [8880a93a5c00, 8880a93a5e00) The buggy address belongs to the page: page:64ff38cf refcount:1 mapcount:0 mapping: index:0x0 pfn:0xa93a5 flags: 0xfffe000200(slab) raw: 00fffe000200 ea00028deec8 ea00027a5388 8880aa000600 raw: 8880a93a5000 00010004 page dumped because: kasan: bad access detected Memory state around the buggy address: 8880a93a5d00: 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc 8880a93a5d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >8880a93a5e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ 8880a93a5e80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc 8880a93a5f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc == Reported-by: syzbot+7da3fdf292816554b...@syzkaller.appspotmail.com Signed-off-by: B K Karthik --- net/ipv6/xfrm6_tunnel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c index 25b7ebda2fab..cab7693ccfe3 100644 --- a/net/ipv6/xfrm6_tunnel.c +++ b/net/ipv6/xfrm6_tunne
[PATCH] smack: fix slab-out-of-bounds by checking for overflow
add a barrier to smk_set_cipso() to check for overflow == BUG: KASAN: slab-out-of-bounds in vsscanf+0x2666/0x2ef0 lib/vsprintf.c:3321 Read of size 1 at addr 888097d682b8 by task syz-executor980/6804 CPU: 0 PID: 6804 Comm: syz-executor980 Not tainted 5.8.0-rc5-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1f0/0x31e lib/dump_stack.c:118 print_address_description+0x66/0x5a0 mm/kasan/report.c:383 __kasan_report mm/kasan/report.c:513 [inline] kasan_report+0x132/0x1d0 mm/kasan/report.c:530 vsscanf+0x2666/0x2ef0 lib/vsprintf.c:3321 sscanf+0x6c/0x90 lib/vsprintf.c:3527 smk_set_cipso+0x374/0x6c0 security/smack/smackfs.c:908 vfs_write+0x2dd/0xc70 fs/read_write.c:576 ksys_write+0x11b/0x220 fs/read_write.c:631 do_syscall_64+0x73/0xe0 arch/x86/entry/common.c:384 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x4402d9 Code: Bad RIP value. RSP: 002b:7ffe89010db8 EFLAGS: 0246 ORIG_RAX: 0001 RAX: ffda RBX: 004002c8 RCX: 004402d9 RDX: 0037 RSI: 2040 RDI: 0003 RBP: 006ca018 R08: 0014 R09: 004002c8 R10: R11: 0246 R12: 00401ae0 R13: 00401b70 R14: R15: Allocated by task 6804: save_stack mm/kasan/common.c:48 [inline] set_track mm/kasan/common.c:56 [inline] __kasan_kmalloc+0x103/0x140 mm/kasan/common.c:494 __do_kmalloc mm/slab.c:3656 [inline] __kmalloc_track_caller+0x249/0x320 mm/slab.c:3671 memdup_user_nul+0x26/0xf0 mm/util.c:259 smk_set_cipso+0xff/0x6c0 security/smack/smackfs.c:859 vfs_write+0x2dd/0xc70 fs/read_write.c:576 ksys_write+0x11b/0x220 fs/read_write.c:631 do_syscall_64+0x73/0xe0 arch/x86/entry/common.c:384 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 4906: save_stack mm/kasan/common.c:48 [inline] set_track mm/kasan/common.c:56 [inline] kasan_set_free_info mm/kasan/common.c:316 [inline] __kasan_slab_free+0x114/0x170 mm/kasan/common.c:455 __cache_free mm/slab.c:3426 [inline] kfree+0x10a/0x220 mm/slab.c:3757 tomoyo_path_number_perm+0x525/0x690 security/tomoyo/file.c:736 tomoyo_path_mknod+0x128/0x150 security/tomoyo/tomoyo.c:240 security_path_mknod+0xdc/0x160 security/security.c:1077 may_o_create fs/namei.c:2919 [inline] lookup_open fs/namei.c:3060 [inline] open_last_lookups fs/namei.c:3169 [inline] path_openat+0xbe8/0x37f0 fs/namei.c:3357 do_filp_open+0x191/0x3a0 fs/namei.c:3387 do_sys_openat2+0x463/0x770 fs/open.c:1179 do_sys_open fs/open.c:1195 [inline] ksys_open include/linux/syscalls.h:1388 [inline] __do_sys_open fs/open.c:1201 [inline] __se_sys_open fs/open.c:1199 [inline] __x64_sys_open+0x1af/0x1e0 fs/open.c:1199 do_syscall_64+0x73/0xe0 arch/x86/entry/common.c:384 entry_SYSCALL_64_after_hwframe+0x44/0xa9 The buggy address belongs to the object at 888097d68280 which belongs to the cache kmalloc-64 of size 64 The buggy address is located 56 bytes inside of 64-byte region [888097d68280, 888097d682c0) The buggy address belongs to the page: page:ea00025f5a00 refcount:1 mapcount:0 mapping: index:0x888097d68c80 flags: 0xfffe000200(slab) raw: 00fffe000200 ea000288fe08 ea00026f38c8 8880aa400380 raw: 888097d68c80 888097d68000 0001001e page dumped because: kasan: bad access detected Memory state around the buggy address: 888097d68180: 00 00 00 00 01 fc fc fc fc fc fc fc fc fc fc fc 888097d68200: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc >888097d68280: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc ^ 888097d68300: 00 00 00 00 01 fc fc fc fc fc fc fc fc fc fc fc 888097d68380: 00 00 00 00 01 fc fc fc fc fc fc fc fc fc fc fc == Reported-and-testedby: syzbot+a22c6092d003d6fe1...@syzkaller.appspotmail.com Signed-off-by: B K Karthik --- security/smack/smackfs.c | 5 + 1 file changed, 5 insertions(+) diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c index 58d3f43cc8bb..17809310d046 100644 --- a/security/smack/smackfs.c +++ b/security/smack/smackfs.c @@ -905,6 +905,11 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf, for (i = 0; i < catlen; i++) { rule += SMK_DIGITLEN; + if (rule > data + count) { + rc = -EOVERFLOW; + goto out; + } + ret = sscanf(rule, "%u", ); if (ret != 1 || cat > SMACK_CIPSO_MAXCATNUM) goto out; -- 2.20.1 signature.asc Description: PGP signature
[PATCH] net: ipv6: fix slab-out-of-bounda Read in xfrm6_tunnel_alloc_spi
fix slab-out-of-bounds Read in xfrm6_tunnel_alloc_spi by checking for existance of head for the list spi_byspi == BUG: KASAN: slab-out-of-bounds in __xfrm6_tunnel_alloc_spi net/ipv6/xfrm6_tunnel.c:124 [inline] BUG: KASAN: slab-out-of-bounds in xfrm6_tunnel_alloc_spi+0x779/0x8a0 net/ipv6/xfrm6_tunnel.c:174 Read of size 4 at addr 88809a3fe000 by task syz-executor597/6834 CPU: 1 PID: 6834 Comm: syz-executor597 Not tainted 5.8.0-rc5-next-20200716-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x18f/0x20d lib/dump_stack.c:118 print_address_description.constprop.0.cold+0xae/0x497 mm/kasan/report.c:383 __kasan_report mm/kasan/report.c:513 [inline] kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530 __xfrm6_tunnel_alloc_spi net/ipv6/xfrm6_tunnel.c:124 [inline] xfrm6_tunnel_alloc_spi+0x779/0x8a0 net/ipv6/xfrm6_tunnel.c:174 ipcomp6_tunnel_create net/ipv6/ipcomp6.c:84 [inline] ipcomp6_tunnel_attach net/ipv6/ipcomp6.c:124 [inline] ipcomp6_init_state net/ipv6/ipcomp6.c:159 [inline] ipcomp6_init_state+0x2af/0x700 net/ipv6/ipcomp6.c:139 __xfrm_init_state+0x9a6/0x14b0 net/xfrm/xfrm_state.c:2498 xfrm_init_state+0x1a/0x70 net/xfrm/xfrm_state.c:2525 pfkey_msg2xfrm_state net/key/af_key.c:1291 [inline] pfkey_add+0x1a10/0x2b70 net/key/af_key.c:1508 pfkey_process+0x66d/0x7a0 net/key/af_key.c:2834 pfkey_sendmsg+0x42d/0x800 net/key/af_key.c:3673 sock_sendmsg_nosec net/socket.c:651 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:671 sys_sendmsg+0x331/0x810 net/socket.c:2362 ___sys_sendmsg+0xf3/0x170 net/socket.c:2416 __sys_sendmmsg+0x195/0x480 net/socket.c:2506 __do_sys_sendmmsg net/socket.c:2535 [inline] __se_sys_sendmmsg net/socket.c:2532 [inline] __x64_sys_sendmmsg+0x99/0x100 net/socket.c:2532 do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:384 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x440409 Code: Bad RIP value. RSP: 002b:7ffea3e50018 EFLAGS: 0246 ORIG_RAX: 0133 RAX: ffda RBX: 004002c8 RCX: 00440409 RDX: 04000282 RSI: 2180 RDI: 0003 RBP: 006ca018 R08: 004002c8 R09: 004002c8 R10: R11: 0246 R12: 00401c10 R13: 00401ca0 R14: R15: Allocated by task 6731: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48 kasan_set_track mm/kasan/common.c:56 [inline] __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:461 slab_post_alloc_hook mm/slab.h:535 [inline] slab_alloc mm/slab.c:3312 [inline] kmem_cache_alloc+0x138/0x3a0 mm/slab.c:3482 dup_fd+0x89/0xc90 fs/file.c:293 copy_files kernel/fork.c:1459 [inline] copy_process+0x1dd0/0x6b70 kernel/fork.c:2064 _do_fork+0xe8/0xb10 kernel/fork.c:2434 __do_sys_clone+0xc8/0x110 kernel/fork.c:2551 do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:384 entry_SYSCALL_64_after_hwframe+0x44/0xa9 The buggy address belongs to the object at 88809a3fe0c0 which belongs to the cache files_cache of size 832 The buggy address is located 192 bytes to the left of 832-byte region [88809a3fe0c0, 88809a3fe400) The buggy address belongs to the page: page:7671797d refcount:1 mapcount:0 mapping: index:0x88809a3fec00 pfn:0x9a3fe flags: 0xfffe000200(slab) raw: 00fffe000200 ea00027a5248 ea0002a3b648 88821bc47600 raw: 88809a3fec00 88809a3fe0c0 00010003 page dumped because: kasan: bad access detected Memory state around the buggy address: 88809a3fdf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc 88809a3fdf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >88809a3fe000: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ 88809a3fe080: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00 88809a3fe100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 == Reported-and-testedby: syzbot+87b2b4484df1d40e7...@syzkaller.appspotmail.com Signed-off-by: B K Karthik --- net/ipv6/xfrm6_tunnel.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c index 25b7ebda2fab..2d049244be81 100644 --- a/net/ipv6/xfrm6_tunnel.c +++ b/net/ipv6/xfrm6_tunnel.c @@ -121,8 +121,9 @@ static u32 __xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr) struct xfrm6_tunnel_spi *x6spi; int index; - if (xfrm6_tn->spi < XFRM6_TUNNEL_SPI_MIN || - xfrm6_tn->spi >= XFRM6_TUNNEL_SPI_MAX) + if ((xfrm6_tn->spi < XFRM6_TUNNEL_SPI_MIN || + xfrm6_tn->spi >= XFRM6_TUNNEL_SPI_MAX) && + xfrm6_tn->spi_byspi) xfrm6_tn->spi = XFRM6_TUNNEL_SPI_MIN; else
Re: WARNING in pvr2_i2c_core_done
On Wed, 22 Jul 2020 at 14:42, Hillf Danton wrote: > > > From: syzbot > > Tue, 21 Jul 2020 21:06:10 -0700 > > Hello, > > > > syzbot has tested the proposed patch but the reproducer is still triggering > > an issue: > > general protection fault in kernfs_find_ns > > > > pvrusb2: Invalid write control endpoint > > pvrusb2: Invalid write control endpoint > > pvrusb2: Invalid write control endpoint > > pvrusb2: Invalid write control endpoint > > general protection fault, probably for non-canonical address > > 0xdc0e: [#1] SMP KASAN > > KASAN: null-ptr-deref in range [0x0070-0x0077] > > CPU: 0 PID: 78 Comm: pvrusb2-context Not tainted 5.7.0-syzkaller #0 > > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS > > Google 01/01/2011 > > RIP: 0010:kernfs_find_ns+0x31/0x370 fs/kernfs/dir.c:829 > > Code: 49 89 d6 41 55 41 54 55 48 89 fd 53 48 83 ec 08 e8 f4 61 af ff 48 8d > > 7d 70 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f > > 85 1e 03 00 00 48 8d bd 98 00 00 00 48 8b 5d 70 48 > > RSP: 0018:8881d419f938 EFLAGS: 00010202 > > RAX: dc00 RBX: 863789c0 RCX: 85a79ba7 > > RDX: 000e RSI: 81901d1c RDI: 0070 > > RBP: R08: R09: 873ed1e7 > > R10: fbfff0e7da3c R11: 0001 R12: > > R13: R14: R15: 863790e0 > > FS: () GS:8881db20() knlGS: > > CS: 0010 DS: ES: CR0: 80050033 > > CR2: 7f3a7e248000 CR3: 0001d2224000 CR4: 001406f0 > > DR0: DR1: DR2: > > DR3: DR6: fffe0ff0 DR7: 0400 > > Call Trace: > > kernfs_find_and_get_ns+0x2f/0x60 fs/kernfs/dir.c:906 > > kernfs_find_and_get include/linux/kernfs.h:548 [inline] > > sysfs_unmerge_group+0x5d/0x160 fs/sysfs/group.c:366 > > dpm_sysfs_remove+0x62/0xb0 drivers/base/power/sysfs.c:790 > > [3] > > > device_del+0x18b/0xd20 drivers/base/core.c:2834 > > device_unregister+0x22/0xc0 drivers/base/core.c:2889 > > i2c_unregister_device include/linux/err.h:41 [inline] > > [2] > > > i2c_client_dev_release+0x39/0x50 drivers/i2c/i2c-core-base.c:465 > > device_release+0x71/0x200 drivers/base/core.c:1559 > > [1] kobject_del() goes before the release cb in kobject_cleanup() and > kobj is removed from sysfs, see [3] above. Oh, thank you for letting me know about this. Forgive me, but I did not understand you very clearly. I presume you are saying that the second call to i2c_unregister_device() is where the problem occurs? please let me know. thanks, karthik
[PATCH v2] i2c: fix WARNING in pvr2_i2c_core_done
#syz test: https://github.com/google/kasan.git usb-fuzzer fix WARNING in pvr2_i2c_core_done by unregistering device in the release handler instead of the disconnect handler, setting the linked flag after adding adapter to i2c, and removing a call to acpi_ut_delete_generic_state() Reported-by: syzbot+e74a998ca8f1df9cc...@syzkaller.appspotmail.com Signed-off-by: B K Karthik --- v1 -> v2: remove a call to acpi_ut_delete_generic state and set linked flag after adding adapter to i2c as suggested by Hillf Danton drivers/acpi/acpica/utdelete.c | 5 - drivers/i2c/i2c-core-base.c | 2 +- drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c | 4 ++-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c index c365faf4e6cd..e36f51725854 100644 --- a/drivers/acpi/acpica/utdelete.c +++ b/drivers/acpi/acpica/utdelete.c @@ -648,11 +648,6 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) /* Free any stacked Update State objects */ - while (state_list) { - state = acpi_ut_pop_generic_state(_list); - acpi_ut_delete_generic_state(state); - } - return (status); } diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index 26f03a14a478..2d377d2e89f1 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -462,6 +462,7 @@ static void i2c_device_shutdown(struct device *dev) static void i2c_client_dev_release(struct device *dev) { + i2c_unregister_device(to_i2c_client(dev)); kfree(to_i2c_client(dev)); } @@ -1527,7 +1528,6 @@ void i2c_del_adapter(struct i2c_adapter *adap) dev_dbg(>dev, "Removing %s at 0x%x\n", client->name, client->addr); list_del(>detected); - i2c_unregister_device(client); } mutex_unlock(>userspace_clients_lock); diff --git a/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c index 63db04fe12d3..09b2c878f459 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c @@ -623,9 +623,9 @@ void pvr2_i2c_core_init(struct pvr2_hdw *hdw) hdw->i2c_adap.dev.parent = >usb_dev->dev; hdw->i2c_adap.algo = >i2c_algo; hdw->i2c_adap.algo_data = hdw; - hdw->i2c_linked = !0; i2c_set_adapdata(>i2c_adap, >v4l2_dev); - i2c_add_adapter(>i2c_adap); + if (!i2c_add_adapter(>i2c_adap)) + hdw->i2c_linked =!0; if (hdw->i2c_func[0x18] == i2c_24xxx_ir) { /* Probe for a different type of IR receiver on this device. This is really the only way to differentiate -- 2.20.1 signature.asc Description: PGP signature
[PATCH v2] tty: serial: fsl_lpuart.c: prevent a bad shift operation
prevent a bad shift operation by verifying that the argument to fls is non zero. Reported-by: "Vabhav Sharma (OSS)" Signed-off-by: B K Karthik --- v1 -> v2: added Reported-by tag drivers/tty/serial/fsl_lpuart.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index 7ca642249224..0cc64279cd2d 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -1168,7 +1168,8 @@ static inline int lpuart_start_rx_dma(struct lpuart_port *sport) * 10ms at any baud rate. */ sport->rx_dma_rng_buf_len = (DMA_RX_TIMEOUT * baud / bits / 1000) * 2; - sport->rx_dma_rng_buf_len = (1 << (fls(sport->rx_dma_rng_buf_len) - 1)); + if (sport->rx_dma_rng_buf_len != 0) + sport->rx_dma_rng_buf_len = (1 << (fls(sport->rx_dma_rng_buf_len) - 1)); if (sport->rx_dma_rng_buf_len < 16) sport->rx_dma_rng_buf_len = 16; -- 2.20.1 signature.asc Description: PGP signature
[PATCH 2/2] tty: serial: fsl_lpuart.c: fix a parentheses coding style issue
add parentheses to expression to improve code readability. Signed-off-by: B K Karthik --- drivers/tty/serial/fsl_lpuart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index 0cc64279cd2d..3108f5ab57fa 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -1167,7 +1167,7 @@ static inline int lpuart_start_rx_dma(struct lpuart_port *sport) * Calculate length of one DMA buffer size to keep latency below * 10ms at any baud rate. */ - sport->rx_dma_rng_buf_len = (DMA_RX_TIMEOUT * baud / bits / 1000) * 2; + sport->rx_dma_rng_buf_len = (((DMA_RX_TIMEOUT * baud) / bits) / 1000) * 2; if (sport->rx_dma_rng_buf_len != 0) sport->rx_dma_rng_buf_len = (1 << (fls(sport->rx_dma_rng_buf_len) - 1)); if (sport->rx_dma_rng_buf_len < 16) -- 2.20.1 signature.asc Description: PGP signature
[PATCH 1/2] tty: serial: fsl_lpuart.c: prevent a bad shift operation
prevent a bad shift operation by verifying that sport->rx_dma_rng_buf_len is non zero. Signed-off-by: B K Karthik --- drivers/tty/serial/fsl_lpuart.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index 7ca642249224..0cc64279cd2d 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -1168,7 +1168,8 @@ static inline int lpuart_start_rx_dma(struct lpuart_port *sport) * 10ms at any baud rate. */ sport->rx_dma_rng_buf_len = (DMA_RX_TIMEOUT * baud / bits / 1000) * 2; - sport->rx_dma_rng_buf_len = (1 << (fls(sport->rx_dma_rng_buf_len) - 1)); + if (sport->rx_dma_rng_buf_len != 0) + sport->rx_dma_rng_buf_len = (1 << (fls(sport->rx_dma_rng_buf_len) - 1)); if (sport->rx_dma_rng_buf_len < 16) sport->rx_dma_rng_buf_len = 16; -- 2.20.1 signature.asc Description: PGP signature
Re: WARNING in pvr2_i2c_core_done
On Tue, Jul 21, 2020 at 4:50 PM syzbot wrote: > > Hello, > > syzbot has tested the proposed patch but the reproducer is still triggering > an issue: > general protection fault in kernfs_find_ns > > pvrusb2: Invalid write control endpoint > pvrusb2: Invalid write control endpoint > pvrusb2: Invalid write control endpoint > pvrusb2: Invalid write control endpoint > pvrusb2: Invalid write control endpoint > pvrusb2: Invalid write control endpoint > general protection fault, probably for non-canonical address > 0xdc0e: [#1] SMP KASAN > KASAN: null-ptr-deref in range [0x0070-0x0077] I'm guessing this has to do with kmem_cache_free() called by i2c_acpi_remove_space_handler() through acpi_ut_delete_generic_state() in drivers/acpi/osl.c:1708 ? > CPU: 0 PID: 78 Comm: pvrusb2-context Not tainted 5.7.0-syzkaller #0 > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS > Google 01/01/2011 > RIP: 0010:kernfs_find_ns+0x31/0x370 fs/kernfs/dir.c:829 > Code: 49 89 d6 41 55 41 54 55 48 89 fd 53 48 83 ec 08 e8 f4 61 af ff 48 8d 7d > 70 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 1e > 03 00 00 48 8d bd 98 00 00 00 48 8b 5d 70 48 > RSP: 0018:8881d4187938 EFLAGS: 00010202 > RAX: dc00 RBX: 863789c0 RCX: 85a79ba7 > RDX: 000e RSI: 81901d1c RDI: 0070 > RBP: R08: R09: 873ed1e7 > R10: fbfff0e7da3c R11: 0001 R12: > R13: R14: R15: 863790e0 > FS: () GS:8881db20() knlGS: > CS: 0010 DS: ES: CR0: 80050033 > CR2: 557f2b45ae48 CR3: 0001d2762000 CR4: 001406f0 > DR0: DR1: DR2: > DR3: DR6: fffe0ff0 DR7: 0400 > Call Trace: > kernfs_find_and_get_ns+0x2f/0x60 fs/kernfs/dir.c:906 > kernfs_find_and_get include/linux/kernfs.h:548 [inline] > sysfs_unmerge_group+0x5d/0x160 fs/sysfs/group.c:366 > dpm_sysfs_remove+0x62/0xb0 drivers/base/power/sysfs.c:790 > device_del+0x18b/0xd20 drivers/base/core.c:2834 > device_unregister+0x22/0xc0 drivers/base/core.c:2889 > i2c_unregister_device include/linux/err.h:41 [inline] > i2c_client_dev_release+0x39/0x50 drivers/i2c/i2c-core-base.c:465 > device_release+0x71/0x200 drivers/base/core.c:1559 > kobject_cleanup lib/kobject.c:693 [inline] > kobject_release lib/kobject.c:722 [inline] > kref_put include/linux/kref.h:65 [inline] > kobject_put+0x245/0x540 lib/kobject.c:739 > put_device drivers/base/core.c:2779 [inline] > device_unregister+0x34/0xc0 drivers/base/core.c:2890 > i2c_unregister_device+0x38/0x40 include/linux/err.h:41 > v4l2_i2c_new_subdev_board+0x159/0x2c0 drivers/media/v4l2-core/v4l2-i2c.c:114 > v4l2_i2c_new_subdev+0xb8/0xf0 drivers/media/v4l2-core/v4l2-i2c.c:135 > pvr2_hdw_load_subdev drivers/media/usb/pvrusb2/pvrusb2-hdw.c:2023 [inline] > pvr2_hdw_load_modules drivers/media/usb/pvrusb2/pvrusb2-hdw.c:2075 [inline] > pvr2_hdw_setup_low drivers/media/usb/pvrusb2/pvrusb2-hdw.c:2156 [inline] > pvr2_hdw_setup drivers/media/usb/pvrusb2/pvrusb2-hdw.c:2262 [inline] > pvr2_hdw_initialize+0xc8d/0x3600 drivers/media/usb/pvrusb2/pvrusb2-hdw.c:2339 > pvr2_context_check drivers/media/usb/pvrusb2/pvrusb2-context.c:109 [inline] > pvr2_context_thread_func+0x250/0x850 > drivers/media/usb/pvrusb2/pvrusb2-context.c:158 > kthread+0x392/0x470 kernel/kthread.c:291 > ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:351 > Modules linked in: > ---[ end trace 9af941b6bcb04b01 ]--- > RIP: 0010:kernfs_find_ns+0x31/0x370 fs/kernfs/dir.c:829 > Code: 49 89 d6 41 55 41 54 55 48 89 fd 53 48 83 ec 08 e8 f4 61 af ff 48 8d 7d > 70 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 1e > 03 00 00 48 8d bd 98 00 00 00 48 8b 5d 70 48 > RSP: 0018:8881d4187938 EFLAGS: 00010202 > RAX: dc00 RBX: 863789c0 RCX: 85a79ba7 > RDX: 000e RSI: 81901d1c RDI: 0070 > RBP: R08: R09: 873ed1e7 > R10: fbfff0e7da3c R11: 0001 R12: > R13: R14: R15: 863790e0 > FS: () GS:8881db20() knlGS: > CS: 0010 DS: ES: CR0: 80050033 > CR2: 557f2b45ae48 CR3: 0001d2762000 CR4: 001406f0 > DR0: DR1: DR2: > DR3: DR6: fffe0ff0 DR7: 0400 > > > Tested on: > > commit: b791d1bd Merge tag 'locking-kcsan-2020-06-11' of git://git.. > git tree: https://github.com/google/kasan.git usb-fuzzer > console output: https://syzkaller.appspot.com/x/log.txt?x=16dfe44090 > kernel config: https://syzkaller.appspot.com/x/.config?x=ccf1899337a6e343 >
[PATCH] i2c: fix WARNING in pvr2_i2c_core_done
#syz test: https://github.com/google/kasan.git usb-fuzzer fix WARNING in pvr2_i2c_core_done by unregistering device in the release handler instead of the disconnect handler. Reported-by: syzbot+e74a998ca8f1df9cc...@syzkaller.appspotmail.com Signed-off-by: B K Karthik --- drivers/i2c/i2c-core-base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index 26f03a14a478..2d377d2e89f1 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -462,6 +462,7 @@ static void i2c_device_shutdown(struct device *dev) static void i2c_client_dev_release(struct device *dev) { + i2c_unregister_device(to_i2c_client(dev)); kfree(to_i2c_client(dev)); } @@ -1527,7 +1528,6 @@ void i2c_del_adapter(struct i2c_adapter *adap) dev_dbg(>dev, "Removing %s at 0x%x\n", client->name, client->addr); list_del(>detected); - i2c_unregister_device(client); } mutex_unlock(>userspace_clients_lock); -- 2.20.1 signature.asc Description: PGP signature
[PATCH] MAINTAINERS: mark usbvision as obsolete
mark staging/media/usbvision as obsolete so checkpatch tells people not to send patches. Signed-off-by: B K Karthik --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index a88bf0759c90..82120c2fcedd 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -17946,7 +17946,7 @@ F: include/uapi/linux/uvcvideo.h USB VISION DRIVER M: Hans Verkuil L: linux-me...@vger.kernel.org -S: Odd Fixes +S: Odd Fixes / Obsolete W: https://linuxtv.org T: git git://linuxtv.org/media_tree.git F: drivers/staging/media/usbvision/ -- 2.20.1 signature.asc Description: PGP signature
Re: [PATCH 2/4] staging: rtl8188eu: include: fixed multiple parentheses coding style issues
On Sun, Jul 19, 2020 at 5:26 AM Greg Kroah-Hartman wrote: > > On Sat, Jul 18, 2020 at 05:16:26AM -0400, B K Karthik wrote: > > fixed multiple parentheses coding style issues reported by checkpatch. > > > > Signed-off-by: B K Karthik > > --- > > drivers/staging/rtl8188eu/include/ieee80211.h | 4 +-- > > .../staging/rtl8188eu/include/osdep_service.h | 4 +-- > > drivers/staging/rtl8188eu/include/wifi.h | 34 +-- > > 3 files changed, 21 insertions(+), 21 deletions(-) > > You can never add warnings to the build, like this patch did. Always > test-build your patches at the very least... understood, I will definitely do that. but these warnings are (mostly) [-Wunused-value] and [-Wformat]. that should not have (?) occurred due to the usage of parentheses. anyways, I will try to fix these up and send a v2. sorry if i wasted your time karthik
Re: [PATCH 4/4] staging: rtl8188eu: include: placed constant on the right side of the test in comparisons
On Sat, Jul 18, 2020 at 9:17 AM Joe Perches wrote: > > On Sat, 2020-07-18 at 05:18 -0400, B K Karthik wrote: > > placed constant on the right side of the test > > to fix warnings issued by checkpatch > [] > > diff --git a/drivers/staging/rtl8188eu/include/wifi.h > > b/drivers/staging/rtl8188eu/include/wifi.h > [] > > @@ -326,7 +326,7 @@ static inline unsigned char *get_hdr_bssid(unsigned > > char *pframe) > > > > static inline int IsFrameTypeCtrl(unsigned char *pframe) > > { > > - if (WIFI_CTRL_TYPE == GetFrameType(pframe)) > > + if (GetFrameType(pframe) == WIFI_CTRL_TYPE) > > return true; > > else > > return false; > > Always try to improve code instead of merely shutting > up checkpatch warnings. > > This function should likely be written: > > static inline bool IsFrameTypeCtrl(unsigned char *pframe) > { > return GetFrameType(pframe) == WIFI_CTRL_TYPE; > } > > and given it's used only once, it might be expanded > in that place and removed altogether. > > Something like: > > (and the memcmp below could be ether_addr_equal instead > but I'm too lazy to find out if the addresses are both > guaranteed to be __aligned(2) which is likely) Alright, I will try to do that and send a v2 asap :) > > --- > drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c | 8 +--- > drivers/staging/rtl8188eu/include/wifi.h| 7 --- > 2 files changed, 5 insertions(+), 10 deletions(-) > > diff --git a/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c > b/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c > index 7d0135fde795..a2994f9ecbde 100644 > --- a/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c > +++ b/drivers/staging/rtl8188eu/hal/rtl8188e_rxdesc.c > @@ -144,10 +144,12 @@ void update_recvframe_phyinfo_88e(struct recv_frame > *precvframe, > > wlanhdr = precvframe->pkt->data; > > - pkt_info.bPacketMatchBSSID = ((!IsFrameTypeCtrl(wlanhdr)) && > - !pattrib->icv_err && !pattrib->crc_err && > + pkt_info.bPacketMatchBSSID = > + GetFrameType(wlanhdr) != WIFI_CTRL_TYPE && > + !pattrib->icv_err && > + !pattrib->crc_err && > !memcmp(get_hdr_bssid(wlanhdr), > -get_bssid(>mlmepriv), ETH_ALEN)); > + get_bssid(>mlmepriv), ETH_ALEN); > > pkt_info.bPacketToSelf = pkt_info.bPacketMatchBSSID && > (!memcmp(get_da(wlanhdr), > diff --git a/drivers/staging/rtl8188eu/include/wifi.h > b/drivers/staging/rtl8188eu/include/wifi.h > index 791f287a546d..3998d5633860 100644 > --- a/drivers/staging/rtl8188eu/include/wifi.h > +++ b/drivers/staging/rtl8188eu/include/wifi.h > @@ -324,13 +324,6 @@ static inline unsigned char *get_hdr_bssid(unsigned char > *pframe) > return sa; > } > > -static inline int IsFrameTypeCtrl(unsigned char *pframe) > -{ > - if (WIFI_CTRL_TYPE == GetFrameType(pframe)) > - return true; > - else > - return false; > -} > > /*- > Below is for the security related definition > > --*/ thank you for pointing me. karthik
[PATCH 4/4] staging: rtl8188eu: include: placed constant on the right side of the test in comparisons
placed constant on the right side of the test to fix warnings issued by checkpatch Signed-off-by: B K Karthik --- drivers/staging/rtl8188eu/include/rtw_mlme.h | 4 ++-- drivers/staging/rtl8188eu/include/wifi.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme.h b/drivers/staging/rtl8188eu/include/rtw_mlme.h index 010f0c42368a..1b74b32b8a81 100644 --- a/drivers/staging/rtl8188eu/include/rtw_mlme.h +++ b/drivers/staging/rtl8188eu/include/rtw_mlme.h @@ -266,7 +266,7 @@ static inline void set_fwstate(struct mlme_priv *pmlmepriv, int state) { pmlmepriv->fw_state |= state; /* FOR HW integration */ - if (_FW_UNDER_SURVEY == state) + if (state == _FW_UNDER_SURVEY) pmlmepriv->bScanInProcess = true; } @@ -274,7 +274,7 @@ static inline void _clr_fwstate_(struct mlme_priv *pmlmepriv, int state) { pmlmepriv->fw_state &= ~state; /* FOR HW integration */ - if (_FW_UNDER_SURVEY == state) + if (state == _FW_UNDER_SURVEY) pmlmepriv->bScanInProcess = false; } diff --git a/drivers/staging/rtl8188eu/include/wifi.h b/drivers/staging/rtl8188eu/include/wifi.h index 677827900607..dcef3da21970 100644 --- a/drivers/staging/rtl8188eu/include/wifi.h +++ b/drivers/staging/rtl8188eu/include/wifi.h @@ -326,7 +326,7 @@ static inline unsigned char *get_hdr_bssid(unsigned char *pframe) static inline int IsFrameTypeCtrl(unsigned char *pframe) { - if (WIFI_CTRL_TYPE == GetFrameType(pframe)) + if (GetFrameType(pframe) == WIFI_CTRL_TYPE) return true; else return false; -- 2.20.1 signature.asc Description: PGP signature
[PATCH 3/4] staging: rtl8188eu: include: enclosed macros in do-while loops
enclosed macros starting with if inside do-while loops to avoid possible if-else logic defects Signed-off-by: B K Karthik --- drivers/staging/rtl8188eu/include/odm_debug.h | 28 +++ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/drivers/staging/rtl8188eu/include/odm_debug.h b/drivers/staging/rtl8188eu/include/odm_debug.h index 857c64b8d2f4..c7a928d396b0 100644 --- a/drivers/staging/rtl8188eu/include/odm_debug.h +++ b/drivers/staging/rtl8188eu/include/odm_debug.h @@ -76,20 +76,24 @@ #endif #define ODM_RT_TRACE(pDM_Odm, comp, level, fmt) \ - if (((comp) & pDM_Odm->DebugComponents) && \ - (level <= pDM_Odm->DebugLevel)) { \ - pr_info("[ODM-8188E] ");\ - RT_PRINTK fmt; \ - } + do { + if (((comp) & pDM_Odm->DebugComponents) && \ + (level <= pDM_Odm->DebugLevel)) { \ + pr_info("[ODM-8188E] "); \ + RT_PRINTK fmt; \ + } + } while (0) #define ODM_RT_ASSERT(pDM_Odm, expr, fmt) \ - if (!(expr)) { \ - pr_info("Assertion failed! %s at ..\n", #expr); \ - pr_info(" ..%s,%s,line=%d\n", __FILE__,\ - __func__, __LINE__);\ - RT_PRINTK fmt; \ - ASSERT(false); \ - } + do { + if (!(expr)) { \ + pr_info("Assertion failed! %s at ..\n", #expr); \ + pr_info(" ..%s,%s,line=%d\n", __FILE__, \ + __func__, __LINE__); \ + RT_PRINTK fmt; \ + ASSERT(false); \ + } + } while (0) void ODM_InitDebugSetting(struct odm_dm_struct *pDM_Odm); -- 2.20.1 signature.asc Description: PGP signature
[PATCH 2/4] staging: rtl8188eu: include: fixed multiple parentheses coding style issues
fixed multiple parentheses coding style issues reported by checkpatch. Signed-off-by: B K Karthik --- drivers/staging/rtl8188eu/include/ieee80211.h | 4 +-- .../staging/rtl8188eu/include/osdep_service.h | 4 +-- drivers/staging/rtl8188eu/include/wifi.h | 34 +-- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/drivers/staging/rtl8188eu/include/ieee80211.h b/drivers/staging/rtl8188eu/include/ieee80211.h index 83218e7ec0a9..a872a86f89ab 100644 --- a/drivers/staging/rtl8188eu/include/ieee80211.h +++ b/drivers/staging/rtl8188eu/include/ieee80211.h @@ -646,8 +646,8 @@ struct rtw_ieee80211_channel { "flags:0x%08x" \ #define CHAN_ARG(channel) \ - (channel)->hw_value \ - , (channel)->flags \ + ((channel)->hw_value \ + , (channel)->flags) /* Parsed Information Elements */ struct rtw_ieee802_11_elems { diff --git a/drivers/staging/rtl8188eu/include/osdep_service.h b/drivers/staging/rtl8188eu/include/osdep_service.h index 31d897f1d21f..2245cc430981 100644 --- a/drivers/staging/rtl8188eu/include/osdep_service.h +++ b/drivers/staging/rtl8188eu/include/osdep_service.h @@ -76,9 +76,9 @@ struct net_device *rtw_alloc_etherdev_with_old_priv(void *old_priv); void rtw_free_netdev(struct net_device *netdev); #define FUNC_NDEV_FMT "%s(%s)" -#define FUNC_NDEV_ARG(ndev) __func__, ndev->name +#define FUNC_NDEV_ARG(ndev) (__func__, (ndev)->name) #define FUNC_ADPT_FMT "%s(%s)" -#define FUNC_ADPT_ARG(adapter) __func__, adapter->pnetdev->name +#define FUNC_ADPT_ARG(adapter) (__func__, (adapter)->pnetdev->name) /* Macros for handling unaligned memory accesses */ diff --git a/drivers/staging/rtl8188eu/include/wifi.h b/drivers/staging/rtl8188eu/include/wifi.h index 791f287a546d..677827900607 100644 --- a/drivers/staging/rtl8188eu/include/wifi.h +++ b/drivers/staging/rtl8188eu/include/wifi.h @@ -143,57 +143,57 @@ enum WIFI_REG_DOMAIN { #define _ORDER_BIT(15) #define SetToDs(pbuf) \ - *(__le16 *)(pbuf) |= cpu_to_le16(_TO_DS_) + (*(__le16 *)(pbuf) |= cpu_to_le16(_TO_DS_)) #define GetToDs(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_TO_DS_)) != 0) #define ClearToDs(pbuf)\ - *(__le16 *)(pbuf) &= (~cpu_to_le16(_TO_DS_)) + (*(__le16 *)(pbuf) &= (~cpu_to_le16(_TO_DS_))) #define SetFrDs(pbuf) \ - *(__le16 *)(pbuf) |= cpu_to_le16(_FROM_DS_) + (*(__le16 *)(pbuf) |= cpu_to_le16(_FROM_DS_)) #define GetFrDs(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_FROM_DS_)) != 0) #define ClearFrDs(pbuf)\ - *(__le16 *)(pbuf) &= (~cpu_to_le16(_FROM_DS_)) + (*(__le16 *)(pbuf) &= (~cpu_to_le16(_FROM_DS_))) #define get_tofr_ds(pframe)((GetToDs(pframe) << 1) | GetFrDs(pframe)) #define SetMFrag(pbuf) \ - *(__le16 *)(pbuf) |= cpu_to_le16(_MORE_FRAG_) + (*(__le16 *)(pbuf) |= cpu_to_le16(_MORE_FRAG_)) #define GetMFrag(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_MORE_FRAG_)) != 0) #define ClearMFrag(pbuf) \ - *(__le16 *)(pbuf) &= (~cpu_to_le16(_MORE_FRAG_)) + (*(__le16 *)(pbuf) &= (~cpu_to_le16(_MORE_FRAG_))) #define SetRetry(pbuf) \ - *(__le16 *)(pbuf) |= cpu_to_le16(_RETRY_) + (*(__le16 *)(pbuf) |= cpu_to_le16(_RETRY_)) #define GetRetry(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_RETRY_)) != 0) #define ClearRetry(pbuf) \ - *(__le16 *)(pbuf) &= (~cpu_to_le16(_RETRY_)) + (*(__le16 *)(pbuf) &= (~cpu_to_le16(_RETRY_))) #define SetPwrMgt(pbuf)\ - *(__le16 *)(pbuf) |= cpu_to_le16(_PWRMGT_) + (*(__le16 *)(pbuf) |= cpu_to_le16(_PWRMGT_)) #define GetPwrMgt(pbuf)(((*(__le16 *)(pbuf)) & cpu_to_le16(_PWRMGT_)) != 0) #define ClearPwrMgt(pbuf) \ - *(__le16 *)(pbuf) &= (~cpu_to_le16(_PWRMGT_)) + (*(__le16 *)(pbuf) &= (~cpu_to_le16(_PWRMGT_))) #define SetMData(pbuf) \ - *(__le16 *)(pbuf) |= cpu_to_le16(_MORE_DATA_) + (*(__le16 *)(pbuf) |= cpu_to_le16(_MORE_DATA_)) #define GetMData(pbuf) (((*(__le16 *)(pbuf)) & cpu_to_le16(_MORE_DATA_)) != 0) #define ClearMData(pbuf) \ - *(__le16 *)(pbuf) &= (~cpu_to_le16(_MORE_DATA_)) + (*(__le16 *)(pbuf) &= (~cpu_to_le16(_MORE_DATA_))) #define SetPrivacy(pbuf) \ - *(__le16 *)(pbuf) |= cpu_to_le16(_PRIVACY_) + (*(__le16 *)(pbuf) |= cpu_to_le16(_PRIVACY_)) #define GetPrivacy(pbuf) \ (((*(__le16 *)(pbuf)) & cpu_to_le16(_PRIVACY_)) != 0) @@ -228,18 +228,18 @@ enum WIFI_REG_DOMAIN { } while (0) #define SetDuration(pbuf, dur) \ - *(__le16 *)((size_t)(pbuf) + 2) = cpu_to_le16(0x & (dur)) + (*(__le16 *)((size_t)(pbuf) + 2) = cpu_to_le16(0x & (dur))) #define SetPriority(pbuf, tid) \ - *(__le16 *)(pbuf) |= cpu_to_le16(tid & 0xf) +
[PATCH 1/4] staging: rtl8188eu: include: fixed multiple blank space coding style issues
fixed multiple blank space coding style issues reported by checkpatch Signed-off-by: B K Karthik --- drivers/staging/rtl8188eu/include/hal_com.h | 2 +- drivers/staging/rtl8188eu/include/osdep_service.h | 2 +- drivers/staging/rtl8188eu/include/rtl8188e_hal.h | 2 +- drivers/staging/rtl8188eu/include/rtl8188e_xmit.h | 12 ++-- drivers/staging/rtl8188eu/include/rtw_cmd.h | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/rtl8188eu/include/hal_com.h b/drivers/staging/rtl8188eu/include/hal_com.h index 542e6e93ff8e..da772a6ebad3 100644 --- a/drivers/staging/rtl8188eu/include/hal_com.h +++ b/drivers/staging/rtl8188eu/include/hal_com.h @@ -81,7 +81,7 @@ #defineRATE_ALL_OFDM_AG(RATR_6M | RATR_9M | RATR_12M | RATR_18M | \ RATR_24M | RATR_36M | RATR_48M | RATR_54M) #defineRATE_ALL_OFDM_1SS (RATR_MCS0 | RATR_MCS1 | RATR_MCS2 | \ -RATR_MCS3 | RATR_MCS4 | RATR_MCS5|RATR_MCS6 | \ +RATR_MCS3 | RATR_MCS4 | RATR_MCS5 | RATR_MCS6 | \ RATR_MCS7) #defineRATE_ALL_OFDM_2SS (RATR_MCS8 | RATR_MCS9 | RATR_MCS10 | \ RATR_MCS11 | RATR_MCS12 | RATR_MCS13 | \ diff --git a/drivers/staging/rtl8188eu/include/osdep_service.h b/drivers/staging/rtl8188eu/include/osdep_service.h index 0d3e4a6e7e85..31d897f1d21f 100644 --- a/drivers/staging/rtl8188eu/include/osdep_service.h +++ b/drivers/staging/rtl8188eu/include/osdep_service.h @@ -82,7 +82,7 @@ void rtw_free_netdev(struct net_device *netdev); /* Macros for handling unaligned memory accesses */ -#define RTW_GET_BE24(a) u32)(a)[0]) << 16) | (((u32) (a)[1]) << 8) | \ +#define RTW_GET_BE24(a) u32)(a)[0]) << 16) | (((u32)(a)[1]) << 8) | \ ((u32)(a)[2])) void rtw_buf_free(u8 **buf, u32 *buf_len); diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h index ba7c98712934..3be28a6dbd49 100644 --- a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h @@ -104,7 +104,7 @@ enum usb_rx_agg_mode { (WMM_NORMAL_TX_TOTAL_PAGE_NUMBER + 1) /* 0xA9 */ /* Chip specific */ -#define CHIP_BONDING_IDENTIFIER(_value)(((_value)>>22)&0x3) +#define CHIP_BONDING_IDENTIFIER(_value)(((_value) >> 22) & 0x3) #define CHIP_BONDING_92C_1T2R 0x1 #define CHIP_BONDING_88C_USB_MCARD 0x2 #define CHIP_BONDING_88C_USB_HP0x1 diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_xmit.h b/drivers/staging/rtl8188eu/include/rtl8188e_xmit.h index 49884cceb349..1472c597cc53 100644 --- a/drivers/staging/rtl8188eu/include/rtl8188e_xmit.h +++ b/drivers/staging/rtl8188eu/include/rtl8188e_xmit.h @@ -30,11 +30,11 @@ #define SET_EARLYMODE_LEN2_1(__pAddr, __Value) \ SET_BITS_TO_LE_4BYTE(__pAddr, 28, 4, __Value) #define SET_EARLYMODE_LEN2_2(__pAddr, __Value) \ - SET_BITS_TO_LE_4BYTE(__pAddr+4, 0, 8, __Value) + SET_BITS_TO_LE_4BYTE(__pAddr + 4, 0, 8, __Value) #define SET_EARLYMODE_LEN3(__pAddr, __Value) \ - SET_BITS_TO_LE_4BYTE(__pAddr+4, 8, 12, __Value) + SET_BITS_TO_LE_4BYTE(__pAddr + 4, 8, 12, __Value) #define SET_EARLYMODE_LEN4(__pAddr, __Value) \ - SET_BITS_TO_LE_4BYTE(__pAddr+4, 20, 12, __Value) + SET_BITS_TO_LE_4BYTE(__pAddr + 4, 20, 12, __Value) /* */ /* defined for TX DESC Operation */ @@ -100,7 +100,7 @@ enum TXDESC_SC { #define txdesc_set_ccx_sw_88e(txdesc, value) \ do { \ - ((struct txdesc_88e *)(txdesc))->sw1 = (((value)>>8) & 0x0f); \ + ((struct txdesc_88e *)(txdesc))->sw1 = (((value) >> 8) & 0x0f); \ ((struct txdesc_88e *)(txdesc))->sw0 = ((value) & 0xff); \ } while (0) @@ -138,9 +138,9 @@ struct txrpt_ccx_88e { u8 sw0; }; -#define txrpt_ccx_sw_88e(txrpt_ccx) ((txrpt_ccx)->sw0 + ((txrpt_ccx)->sw1<<8)) +#define txrpt_ccx_sw_88e(txrpt_ccx) ((txrpt_ccx)->sw0 + ((txrpt_ccx)->sw1 << 8)) #define txrpt_ccx_qtime_88e(txrpt_ccx) \ - ((txrpt_ccx)->ccx_qtime0+((txrpt_ccx)->ccx_qtime1<<8)) + ((txrpt_ccx)->ccx_qtime0 + ((txrpt_ccx)->ccx_qtime1 << 8)) void rtl8188e_fill_fake_txdesc(struct adapter *padapter, u8 *pDesc, u32 BufferLen, u8 IsPsPoll, u8 IsBTQosNull); diff --git a/drivers/staging/rtl8188eu/include/rtw_cmd.h b/drivers/staging/rtl8188eu/include/rtw_cmd.h index fa5e212fc9e0..002a797c6d0a 100644 --- a/drivers/staging/rtl8188eu/include/rtw_cmd.h +++ b/drivers/staging/rtl8188eu/include/rtw_cmd.h @@ -115,7 +115,7 @@ struct setopmode_parm { */ #define RTW_SSID_SCAN_AMOUNT
[PATCH v5] staging: comedi: comedi_fops.c: added casts to get rid of sparse warnings
fixed sparse warnings by adding a cast in assignment from void [noderef] __user * to unsigned int __force * and a reverse cast in argument from unsigned int * to unsigned int __user * . Signed-off-by: B K Karthik Reviewed-by: Ian Abbott --- v1 -> v2: - Added a reverse cast in argument v2 -> v3: - Changed commit description v3 -> v4: - Added versioning info in commit description v4 -> v5: - Move versioning info below the divider line drivers/staging/comedi/comedi_fops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 3f70e5dfac39..9cdc1e8a022d 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2956,7 +2956,7 @@ static int get_compat_cmd(struct comedi_cmd *cmd, cmd->scan_end_arg = v32.scan_end_arg; cmd->stop_src = v32.stop_src; cmd->stop_arg = v32.stop_arg; - cmd->chanlist = compat_ptr(v32.chanlist); + cmd->chanlist = (unsigned int __force *)compat_ptr(v32.chanlist); cmd->chanlist_len = v32.chanlist_len; cmd->data = compat_ptr(v32.data); cmd->data_len = v32.data_len; @@ -2983,7 +2983,7 @@ static int put_compat_cmd(struct comedi32_cmd_struct __user *cmd32, v32.stop_src = cmd->stop_src; v32.stop_arg = cmd->stop_arg; /* Assume chanlist pointer is unchanged. */ - v32.chanlist = ptr_to_compat(cmd->chanlist); + v32.chanlist = ptr_to_compat((unsigned int __user *)cmd->chanlist); v32.chanlist_len = cmd->chanlist_len; v32.data = ptr_to_compat(cmd->data); v32.data_len = cmd->data_len; -- 2.20.1 signature.asc Description: PGP signature
[PATCH v4] staging: comedi: comedi_fops.c: added casts to get rid of sparse warnings
fixed sparse warnings by adding a cast in assignment from void [noderef] __user * to unsigned int __force * and a reverse cast in argument from unsigned int * to unsigned int __user * . v1 -> v2: - Add a reverse cast in argument v2 -> v3: - Change commit description as suggested by Ian Abott v3 -> v4: - Add versioning information in commit description Signed-off-by: B K Karthik --- drivers/staging/comedi/comedi_fops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 3f70e5dfac39..9cdc1e8a022d 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2956,7 +2956,7 @@ static int get_compat_cmd(struct comedi_cmd *cmd, cmd->scan_end_arg = v32.scan_end_arg; cmd->stop_src = v32.stop_src; cmd->stop_arg = v32.stop_arg; - cmd->chanlist = compat_ptr(v32.chanlist); + cmd->chanlist = (unsigned int __force *)compat_ptr(v32.chanlist); cmd->chanlist_len = v32.chanlist_len; cmd->data = compat_ptr(v32.data); cmd->data_len = v32.data_len; @@ -2983,7 +2983,7 @@ static int put_compat_cmd(struct comedi32_cmd_struct __user *cmd32, v32.stop_src = cmd->stop_src; v32.stop_arg = cmd->stop_arg; /* Assume chanlist pointer is unchanged. */ - v32.chanlist = ptr_to_compat(cmd->chanlist); + v32.chanlist = ptr_to_compat((unsigned int __user *)cmd->chanlist); v32.chanlist_len = cmd->chanlist_len; v32.data = ptr_to_compat(cmd->data); v32.data_len = cmd->data_len; -- 2.20.1 signature.asc Description: PGP signature
Re: [PATCH v3] staging: comedi: comedi_fops.c: added casts to get rid of sparse warnings
On Thu, Jul 16, 2020 at 10:25 AM Greg Kroah-Hartman wrote: > > On Thu, Jul 16, 2020 at 10:17:47AM -0400, B K Karthik wrote: > > fixed sparse warnings by adding a cast in assignment from > > void [noderef] __user * to unsigned int __force * > > and a reverse cast in argument from > > unsigned int * to unsigned int __user * . > > > > Signed-off-by: B K Karthik > > --- > > drivers/staging/comedi/comedi_fops.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > What changed from previous versions? As Ian Abbott said "Minor quibble: the reverse cast is actually from unsigned int * to" Hence this is a change in the commit description. > > That always goes below the --- line. I did not understand this sir, can you please clarify? thanks, karthik
[PATCH v3] staging: comedi: comedi_fops.c: added casts to get rid of sparse warnings
fixed sparse warnings by adding a cast in assignment from void [noderef] __user * to unsigned int __force * and a reverse cast in argument from unsigned int * to unsigned int __user * . Signed-off-by: B K Karthik --- drivers/staging/comedi/comedi_fops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 3f70e5dfac39..9cdc1e8a022d 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2956,7 +2956,7 @@ static int get_compat_cmd(struct comedi_cmd *cmd, cmd->scan_end_arg = v32.scan_end_arg; cmd->stop_src = v32.stop_src; cmd->stop_arg = v32.stop_arg; - cmd->chanlist = compat_ptr(v32.chanlist); + cmd->chanlist = (unsigned int __force *)compat_ptr(v32.chanlist); cmd->chanlist_len = v32.chanlist_len; cmd->data = compat_ptr(v32.data); cmd->data_len = v32.data_len; @@ -2983,7 +2983,7 @@ static int put_compat_cmd(struct comedi32_cmd_struct __user *cmd32, v32.stop_src = cmd->stop_src; v32.stop_arg = cmd->stop_arg; /* Assume chanlist pointer is unchanged. */ - v32.chanlist = ptr_to_compat(cmd->chanlist); + v32.chanlist = ptr_to_compat((unsigned int __user *)cmd->chanlist); v32.chanlist_len = cmd->chanlist_len; v32.data = ptr_to_compat(cmd->data); v32.data_len = cmd->data_len; -- 2.20.1 signature.asc Description: PGP signature
[PATCH] fs: block_dev.c: fix WARNING in submit_bio_check
duplicating the logic in blkdev_get_by_path to blkdev_get_by_dev to avoid a user-triggerable WARN trying to write to a read-only block device. blkdev_get_by_path() looks at ((mode & FMODE_WRITE) && bdev_read_only(bdev)) to check for write permissions. A user-triggerable WARN can be avoided by doing the same with bdev_get_by_dev. Reported-by: syzbot+4c50ac32e5b10e413...@syzkaller.appspotmail.com Signed-off-by: B K Karthik --- fs/block_dev.c | 5 + 1 file changed, 5 insertions(+) diff --git a/fs/block_dev.c b/fs/block_dev.c index 64c4fe8181f2..472e3b046406 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1796,6 +1796,11 @@ struct block_device *blkdev_get_by_dev(dev_t dev, fmode_t mode, void *holder) if (err) return ERR_PTR(err); + if ((mode & FMODE_WRITE) && bdev_read_only(bdev)) { + blkdev_put(bdev, mode); + return ERR_PTR(-EACCES); + } + return bdev; } EXPORT_SYMBOL(blkdev_get_by_dev); -- 2.20.1 signature.asc Description: PGP signature
[PATCH v2] staging: comedi: comedi_fops.c: added casts to get rid of sparse warnings
fixed sparse warnings by adding a cast in assignment from void [noderef] __user * to unsigned int __force * and a reverse cast in argument from void [noderef] __user * to unsigned int __user * . Signed-off-by: B K Karthik --- drivers/staging/comedi/comedi_fops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 3f70e5dfac39..9cdc1e8a022d 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2956,7 +2956,7 @@ static int get_compat_cmd(struct comedi_cmd *cmd, cmd->scan_end_arg = v32.scan_end_arg; cmd->stop_src = v32.stop_src; cmd->stop_arg = v32.stop_arg; - cmd->chanlist = compat_ptr(v32.chanlist); + cmd->chanlist = (unsigned int __force *)compat_ptr(v32.chanlist); cmd->chanlist_len = v32.chanlist_len; cmd->data = compat_ptr(v32.data); cmd->data_len = v32.data_len; @@ -2983,7 +2983,7 @@ static int put_compat_cmd(struct comedi32_cmd_struct __user *cmd32, v32.stop_src = cmd->stop_src; v32.stop_arg = cmd->stop_arg; /* Assume chanlist pointer is unchanged. */ - v32.chanlist = ptr_to_compat(cmd->chanlist); + v32.chanlist = ptr_to_compat((unsigned int __user *)cmd->chanlist); v32.chanlist_len = cmd->chanlist_len; v32.data = ptr_to_compat(cmd->data); v32.data_len = cmd->data_len; -- 2.20.1 signature.asc Description: PGP signature
Re: [PATCH] staging: comedi: comedi_fops.c: changed type in assignment to unsigned int *
On Wed, Jul 15, 2020 at 7:19 AM Ian Abbott wrote: > > On 15/07/2020 05:48, B K Karthik wrote: > > fixed a sparse warning by changing the type in > > assignment from void [noderef] __user * to unsigned int * > > (different address space) > > > > Signed-off-by: B K Karthik > > --- > > drivers/staging/comedi/comedi_fops.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/staging/comedi/comedi_fops.c > > b/drivers/staging/comedi/comedi_fops.c > > index 3f70e5dfac39..4cc012e231b7 100644 > > --- a/drivers/staging/comedi/comedi_fops.c > > +++ b/drivers/staging/comedi/comedi_fops.c > > @@ -2956,7 +2956,7 @@ static int get_compat_cmd(struct comedi_cmd *cmd, > > cmd->scan_end_arg = v32.scan_end_arg; > > cmd->stop_src = v32.stop_src; > > cmd->stop_arg = v32.stop_arg; > > - cmd->chanlist = compat_ptr(v32.chanlist); > > + cmd->chanlist = (unsigned int *) compat_ptr(v32.chanlist); > > That should be: > > cmd->chanlist = (unsigned int __force *)compat_ptr(v32.chanlist); > > > cmd->chanlist_len = v32.chanlist_len; > > cmd->data = compat_ptr(v32.data); > > cmd->data_len = v32.data_len; > > > > A reverse cast is required in put_compat_cmd(): > > v32.chanlist = ptr_to_compat((unsigned int __user *)cmd->chanlist); > > Those changes will get rid of the sparse warnings. Thank you for the clarifications Ian. I will make the changes and submit a patch thanks, karthik
Re: [PATCH] staging: comedi: comedi_fops.c: changed type in assignment to unsigned int *
On Wed, Jul 15, 2020 at 5:29 AM Greg Kroah-Hartman wrote: > > On Wed, Jul 15, 2020 at 05:21:01AM -0400, B K Karthik wrote: > > On Wed, Jul 15, 2020 at 5:14 AM Greg Kroah-Hartman > > wrote: > > > > > > On Wed, Jul 15, 2020 at 04:41:52AM -0400, B K Karthik wrote: > > > > On Wed, Jul 15, 2020 at 4:31 AM Greg Kroah-Hartman > > > > wrote: > > > > > > > > > > On Wed, Jul 15, 2020 at 01:56:45PM +0530, B K Karthik wrote: > > > > > > On Wed, Jul 15, 2020, 12:38 PM Greg Kroah-Hartman < > > > > > > gre...@linuxfoundation.org> wrote: > > > > > > > > > > > > > On Wed, Jul 15, 2020 at 12:48:13AM -0400, B K Karthik wrote: > > > > > > > > fixed a sparse warning by changing the type in > > > > > > > > assignment from void [noderef] __user * to unsigned int * > > > > > > > > (different address space) > > > > > > > > > > > > > > > > Signed-off-by: B K Karthik > > > > > > > > --- > > > > > > > > drivers/staging/comedi/comedi_fops.c | 2 +- > > > > > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > > > > > > > > > diff --git a/drivers/staging/comedi/comedi_fops.c > > > > > > > b/drivers/staging/comedi/comedi_fops.c > > > > > > > > index 3f70e5dfac39..4cc012e231b7 100644 > > > > > > > > --- a/drivers/staging/comedi/comedi_fops.c > > > > > > > > +++ b/drivers/staging/comedi/comedi_fops.c > > > > > > > > @@ -2956,7 +2956,7 @@ static int get_compat_cmd(struct > > > > > > > > comedi_cmd *cmd, > > > > > > > > cmd->scan_end_arg = v32.scan_end_arg; > > > > > > > > cmd->stop_src = v32.stop_src; > > > > > > > > cmd->stop_arg = v32.stop_arg; > > > > > > > > - cmd->chanlist = compat_ptr(v32.chanlist); > > > > > > > > + cmd->chanlist = (unsigned int *) compat_ptr(v32.chanlist); > > > > > > > > cmd->chanlist_len = v32.chanlist_len; > > > > > > > > cmd->data = compat_ptr(v32.data); > > > > > > > > cmd->data_len = v32.data_len; > > > > > > > > > > > > > > Always run your patches through checkpatch before sending them, > > > > > > > so you > > > > > > > do not have a grumpy maintainer telling you that you have to run > > > > > > > checkpatch on your patch before sending them. > > > > > > > > > > > > > > > > > > > I will. Sorry for that. > > > > > > > > > > > > But the error that's being shown in this patch is something that > > > > > > comes up > > > > > > on its own. > > > > > > > > > > No it is not. > > > > > > > > > > > git format-patch leaves trailing whitespace in blank lines. > > > > > > > > > > It does? Where is any trailing whitespace here? That's not the > > > > > issue. > > > > > > > > To give you an example, > > > > https://lore.kernel.org/lkml/20200714132350.naekk4zqivpuaedi@pesu-pes-edu/ > > > > was a patch i submitted recently. > > > > This is what checkpatch has to say: > > > > > > > > $ perl scripts/checkpatch.pl -f > > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch > > > > ERROR: trailing whitespace > > > > #21: FILE: > > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:21: > > > > + $ > > > > > > > > ERROR: trailing whitespace > > > > #23: FILE: > > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:23: > > > > + $ > > > > > > > > ERROR: trailing whitespace > > > > #30: FILE: > > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:30: > > > > + $ > > > > > > > > ERROR: trailing whitespace > > > > #37: FILE: > > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:37: &g
Re: [PATCH] staging: comedi: comedi_fops.c: changed type in assignment to unsigned int *
On Wed, Jul 15, 2020 at 5:19 AM Greg Kroah-Hartman wrote: > > On Wed, Jul 15, 2020 at 04:47:48AM -0400, B K Karthik wrote: > > On Wed, Jul 15, 2020 at 4:41 AM B K Karthik wrote: > > > > > > On Wed, Jul 15, 2020 at 4:31 AM Greg Kroah-Hartman > > > wrote: > > > > > > > > On Wed, Jul 15, 2020 at 01:56:45PM +0530, B K Karthik wrote: > > > > > On Wed, Jul 15, 2020, 12:38 PM Greg Kroah-Hartman < > > > > > gre...@linuxfoundation.org> wrote: > > > > > > > > > > > On Wed, Jul 15, 2020 at 12:48:13AM -0400, B K Karthik wrote: > > > > > > > fixed a sparse warning by changing the type in > > > > > > > assignment from void [noderef] __user * to unsigned int * > > > > > > > (different address space) > > > > > > > > > > > > > > Signed-off-by: B K Karthik > > > > > > > --- > > > > > > > drivers/staging/comedi/comedi_fops.c | 2 +- > > > > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > > > > > > > diff --git a/drivers/staging/comedi/comedi_fops.c > > > > > > b/drivers/staging/comedi/comedi_fops.c > > > > > > > index 3f70e5dfac39..4cc012e231b7 100644 > > > > > > > --- a/drivers/staging/comedi/comedi_fops.c > > > > > > > +++ b/drivers/staging/comedi/comedi_fops.c > > > > > > > @@ -2956,7 +2956,7 @@ static int get_compat_cmd(struct comedi_cmd > > > > > > > *cmd, > > > > > > > cmd->scan_end_arg = v32.scan_end_arg; > > > > > > > cmd->stop_src = v32.stop_src; > > > > > > > cmd->stop_arg = v32.stop_arg; > > > > > > > - cmd->chanlist = compat_ptr(v32.chanlist); > > > > > > > + cmd->chanlist = (unsigned int *) compat_ptr(v32.chanlist); > > > > > > > cmd->chanlist_len = v32.chanlist_len; > > > > > > > cmd->data = compat_ptr(v32.data); > > > > > > > cmd->data_len = v32.data_len; > > > > > > > > > > > > Always run your patches through checkpatch before sending them, so > > > > > > you > > > > > > do not have a grumpy maintainer telling you that you have to run > > > > > > checkpatch on your patch before sending them. > > > > > > > > > > > > > > > > I will. Sorry for that. > > > > > > > > > > But the error that's being shown in this patch is something that > > > > > comes up > > > > > on its own. > > > > > > > > No it is not. > > > > > > > > > git format-patch leaves trailing whitespace in blank lines. > > > > > > > > It does? Where is any trailing whitespace here? That's not the issue. > > > > > > To give you an example, > > > https://lore.kernel.org/lkml/20200714132350.naekk4zqivpuaedi@pesu-pes-edu/ > > > was a patch i submitted recently. > > > This is what checkpatch has to say: > > > > > > $ perl scripts/checkpatch.pl -f > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch > > > ERROR: trailing whitespace > > > #21: FILE: > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:21: > > > + $ > > > > > > ERROR: trailing whitespace > > > #23: FILE: > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:23: > > > + $ > > > > > > ERROR: trailing whitespace > > > #30: FILE: > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:30: > > > + $ > > > > > > ERROR: trailing whitespace > > > #37: FILE: > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:37: > > > + $ > > > > > > ERROR: trailing whitespace > > > #44: FILE: > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:44: > > > + $ > > > > > > ERROR: trailing whitespace > > > #51: FILE: > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:51: > > > +-- $ > > > > > > total: 6 errors, 0 warnings, 53 lines checked
Re: [PATCH] staging: comedi: comedi_fops.c: changed type in assignment to unsigned int *
On Wed, Jul 15, 2020 at 5:14 AM Greg Kroah-Hartman wrote: > > On Wed, Jul 15, 2020 at 04:41:52AM -0400, B K Karthik wrote: > > On Wed, Jul 15, 2020 at 4:31 AM Greg Kroah-Hartman > > wrote: > > > > > > On Wed, Jul 15, 2020 at 01:56:45PM +0530, B K Karthik wrote: > > > > On Wed, Jul 15, 2020, 12:38 PM Greg Kroah-Hartman < > > > > gre...@linuxfoundation.org> wrote: > > > > > > > > > On Wed, Jul 15, 2020 at 12:48:13AM -0400, B K Karthik wrote: > > > > > > fixed a sparse warning by changing the type in > > > > > > assignment from void [noderef] __user * to unsigned int * > > > > > > (different address space) > > > > > > > > > > > > Signed-off-by: B K Karthik > > > > > > --- > > > > > > drivers/staging/comedi/comedi_fops.c | 2 +- > > > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > > > > > diff --git a/drivers/staging/comedi/comedi_fops.c > > > > > b/drivers/staging/comedi/comedi_fops.c > > > > > > index 3f70e5dfac39..4cc012e231b7 100644 > > > > > > --- a/drivers/staging/comedi/comedi_fops.c > > > > > > +++ b/drivers/staging/comedi/comedi_fops.c > > > > > > @@ -2956,7 +2956,7 @@ static int get_compat_cmd(struct comedi_cmd > > > > > > *cmd, > > > > > > cmd->scan_end_arg = v32.scan_end_arg; > > > > > > cmd->stop_src = v32.stop_src; > > > > > > cmd->stop_arg = v32.stop_arg; > > > > > > - cmd->chanlist = compat_ptr(v32.chanlist); > > > > > > + cmd->chanlist = (unsigned int *) compat_ptr(v32.chanlist); > > > > > > cmd->chanlist_len = v32.chanlist_len; > > > > > > cmd->data = compat_ptr(v32.data); > > > > > > cmd->data_len = v32.data_len; > > > > > > > > > > Always run your patches through checkpatch before sending them, so you > > > > > do not have a grumpy maintainer telling you that you have to run > > > > > checkpatch on your patch before sending them. > > > > > > > > > > > > > I will. Sorry for that. > > > > > > > > But the error that's being shown in this patch is something that comes > > > > up > > > > on its own. > > > > > > No it is not. > > > > > > > git format-patch leaves trailing whitespace in blank lines. > > > > > > It does? Where is any trailing whitespace here? That's not the issue. > > > > To give you an example, > > https://lore.kernel.org/lkml/20200714132350.naekk4zqivpuaedi@pesu-pes-edu/ > > was a patch i submitted recently. > > This is what checkpatch has to say: > > > > $ perl scripts/checkpatch.pl -f > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch > > ERROR: trailing whitespace > > #21: FILE: > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:21: > > + $ > > > > ERROR: trailing whitespace > > #23: FILE: > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:23: > > + $ > > > > ERROR: trailing whitespace > > #30: FILE: > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:30: > > + $ > > > > ERROR: trailing whitespace > > #37: FILE: > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:37: > > + $ > > > > ERROR: trailing whitespace > > #44: FILE: > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:44: > > + $ > > > > ERROR: trailing whitespace > > #51: FILE: > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:51: > > +-- $ > > > > total: 6 errors, 0 warnings, 53 lines checked > > > > NOTE: For some of the reported defects, checkpatch may be able to > > mechanically convert to the typical style using --fix or > > --fix-inplace. > > > > NOTE: Whitespace errors detected. > > You may wish to use scripts/cleanpatch or scripts/cleanfile > > > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch > > has style problems, please review. > > > > NOTE: If any of the errors are false positives, please report > > them to the maintainer, see CHECKPATCH in MAINTAINERS. > > > > Does this happen only to patches I make? Am I making a silly mistake > > while making a patch? > > I don't get that error at all, here's all I get with that patch: this particular patch or > > $ ./scripts/checkpatch.pl x.patch > WARNING: Missing Signed-off-by: line by nominal patch author '' > > total: 0 errors, 1 warnings, 0 checks, 30 lines checked sorry, you've probably done this a million times more than me, but can you try "perl scripts/checkpatch.pl -f x.patch" ? checkpatch seems to behave differently this way. thanks, karthik
Re: [PATCH] staging: comedi: comedi_fops.c: changed type in assignment to unsigned int *
On Wed, Jul 15, 2020 at 4:41 AM B K Karthik wrote: > > On Wed, Jul 15, 2020 at 4:31 AM Greg Kroah-Hartman > wrote: > > > > On Wed, Jul 15, 2020 at 01:56:45PM +0530, B K Karthik wrote: > > > On Wed, Jul 15, 2020, 12:38 PM Greg Kroah-Hartman < > > > gre...@linuxfoundation.org> wrote: > > > > > > > On Wed, Jul 15, 2020 at 12:48:13AM -0400, B K Karthik wrote: > > > > > fixed a sparse warning by changing the type in > > > > > assignment from void [noderef] __user * to unsigned int * > > > > > (different address space) > > > > > > > > > > Signed-off-by: B K Karthik > > > > > --- > > > > > drivers/staging/comedi/comedi_fops.c | 2 +- > > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > > > diff --git a/drivers/staging/comedi/comedi_fops.c > > > > b/drivers/staging/comedi/comedi_fops.c > > > > > index 3f70e5dfac39..4cc012e231b7 100644 > > > > > --- a/drivers/staging/comedi/comedi_fops.c > > > > > +++ b/drivers/staging/comedi/comedi_fops.c > > > > > @@ -2956,7 +2956,7 @@ static int get_compat_cmd(struct comedi_cmd > > > > > *cmd, > > > > > cmd->scan_end_arg = v32.scan_end_arg; > > > > > cmd->stop_src = v32.stop_src; > > > > > cmd->stop_arg = v32.stop_arg; > > > > > - cmd->chanlist = compat_ptr(v32.chanlist); > > > > > + cmd->chanlist = (unsigned int *) compat_ptr(v32.chanlist); > > > > > cmd->chanlist_len = v32.chanlist_len; > > > > > cmd->data = compat_ptr(v32.data); > > > > > cmd->data_len = v32.data_len; > > > > > > > > Always run your patches through checkpatch before sending them, so you > > > > do not have a grumpy maintainer telling you that you have to run > > > > checkpatch on your patch before sending them. > > > > > > > > > > I will. Sorry for that. > > > > > > But the error that's being shown in this patch is something that comes up > > > on its own. > > > > No it is not. > > > > > git format-patch leaves trailing whitespace in blank lines. > > > > It does? Where is any trailing whitespace here? That's not the issue. > > To give you an example, > https://lore.kernel.org/lkml/20200714132350.naekk4zqivpuaedi@pesu-pes-edu/ > was a patch i submitted recently. > This is what checkpatch has to say: > > $ perl scripts/checkpatch.pl -f > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch > ERROR: trailing whitespace > #21: FILE: > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:21: > + $ > > ERROR: trailing whitespace > #23: FILE: > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:23: > + $ > > ERROR: trailing whitespace > #30: FILE: > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:30: > + $ > > ERROR: trailing whitespace > #37: FILE: > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:37: > + $ > > ERROR: trailing whitespace > #44: FILE: > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:44: > + $ > > ERROR: trailing whitespace > #51: FILE: > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:51: > +-- $ > > total: 6 errors, 0 warnings, 53 lines checked > > NOTE: For some of the reported defects, checkpatch may be able to > mechanically convert to the typical style using --fix or --fix-inplace. > > NOTE: Whitespace errors detected. > You may wish to use scripts/cleanpatch or scripts/cleanfile > > ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch > has style problems, please review. > > NOTE: If any of the errors are false positives, please report > them to the maintainer, see CHECKPATCH in MAINTAINERS. > > Does this happen only to patches I make? Am I making a silly mistake > while making a patch? > I use 'git format-patch -1' to generate the patch file. > If I am going wrong somewhere, please let me know. Also, The patch I sent (this thread): $ perl scripts/checkpatch.pl -f ./0001-staging-comedi-comedi_fops.c-changed-void-__user-to-.patch ERROR: trailing whitespace #29: FILE: ./0001-staging-comedi-comedi_fops.c-changed-void-__user-to-.patch:29: +-- $ total: 1 errors, 0 warnings, 31 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. NOTE: Whitespace errors detected. You may wish to use scripts/cleanpatch or scripts/cleanfile ./0001-staging-comedi-comedi_fops.c-changed-void-__user-to-.patch has style problems, please review. NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. Am I using 'git format-patch' or 'checkpatch.pl' the wrong way? thanks, karthik
Re: [PATCH] staging: comedi: comedi_fops.c: changed type in assignment to unsigned int *
On Wed, Jul 15, 2020 at 4:31 AM Greg Kroah-Hartman wrote: > > On Wed, Jul 15, 2020 at 01:56:45PM +0530, B K Karthik wrote: > > On Wed, Jul 15, 2020, 12:38 PM Greg Kroah-Hartman < > > gre...@linuxfoundation.org> wrote: > > > > > On Wed, Jul 15, 2020 at 12:48:13AM -0400, B K Karthik wrote: > > > > fixed a sparse warning by changing the type in > > > > assignment from void [noderef] __user * to unsigned int * > > > > (different address space) > > > > > > > > Signed-off-by: B K Karthik > > > > --- > > > > drivers/staging/comedi/comedi_fops.c | 2 +- > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > diff --git a/drivers/staging/comedi/comedi_fops.c > > > b/drivers/staging/comedi/comedi_fops.c > > > > index 3f70e5dfac39..4cc012e231b7 100644 > > > > --- a/drivers/staging/comedi/comedi_fops.c > > > > +++ b/drivers/staging/comedi/comedi_fops.c > > > > @@ -2956,7 +2956,7 @@ static int get_compat_cmd(struct comedi_cmd *cmd, > > > > cmd->scan_end_arg = v32.scan_end_arg; > > > > cmd->stop_src = v32.stop_src; > > > > cmd->stop_arg = v32.stop_arg; > > > > - cmd->chanlist = compat_ptr(v32.chanlist); > > > > + cmd->chanlist = (unsigned int *) compat_ptr(v32.chanlist); > > > > cmd->chanlist_len = v32.chanlist_len; > > > > cmd->data = compat_ptr(v32.data); > > > > cmd->data_len = v32.data_len; > > > > > > Always run your patches through checkpatch before sending them, so you > > > do not have a grumpy maintainer telling you that you have to run > > > checkpatch on your patch before sending them. > > > > > > > I will. Sorry for that. > > > > But the error that's being shown in this patch is something that comes up > > on its own. > > No it is not. > > > git format-patch leaves trailing whitespace in blank lines. > > It does? Where is any trailing whitespace here? That's not the issue. To give you an example, https://lore.kernel.org/lkml/20200714132350.naekk4zqivpuaedi@pesu-pes-edu/ was a patch i submitted recently. This is what checkpatch has to say: $ perl scripts/checkpatch.pl -f ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch ERROR: trailing whitespace #21: FILE: ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:21: + $ ERROR: trailing whitespace #23: FILE: ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:23: + $ ERROR: trailing whitespace #30: FILE: ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:30: + $ ERROR: trailing whitespace #37: FILE: ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:37: + $ ERROR: trailing whitespace #44: FILE: ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:44: + $ ERROR: trailing whitespace #51: FILE: ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch:51: +-- $ total: 6 errors, 0 warnings, 53 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. NOTE: Whitespace errors detected. You may wish to use scripts/cleanpatch or scripts/cleanfile ../cbridge/1407d/1/0001-drivers-staging-media-atomisp-pci-css_2401_system-ho.patch has style problems, please review. NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. Does this happen only to patches I make? Am I making a silly mistake while making a patch? I use 'git format-patch -1' to generate the patch file. If I am going wrong somewhere, please let me know. > > > It has been reported to the maintainers. > > It was? Where? I am extremely sorry, I should have verified if it was indeed reported before telling it out. It has not been reported (yet). I apologise for my mistake. thanks, karthik
Re: [PATCH] staging: comedi: comedi_fops.c: changed type in assignment to unsigned int *
On Wed, Jul 15, 2020 at 3:08 AM Greg Kroah-Hartman wrote: > > On Wed, Jul 15, 2020 at 12:48:13AM -0400, B K Karthik wrote: > > fixed a sparse warning by changing the type in > > assignment from void [noderef] __user * to unsigned int * > > (different address space) > > > > Signed-off-by: B K Karthik > > --- > > drivers/staging/comedi/comedi_fops.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/staging/comedi/comedi_fops.c > > b/drivers/staging/comedi/comedi_fops.c > > index 3f70e5dfac39..4cc012e231b7 100644 > > --- a/drivers/staging/comedi/comedi_fops.c > > +++ b/drivers/staging/comedi/comedi_fops.c > > @@ -2956,7 +2956,7 @@ static int get_compat_cmd(struct comedi_cmd *cmd, > > cmd->scan_end_arg = v32.scan_end_arg; > > cmd->stop_src = v32.stop_src; > > cmd->stop_arg = v32.stop_arg; > > - cmd->chanlist = compat_ptr(v32.chanlist); > > + cmd->chanlist = (unsigned int *) compat_ptr(v32.chanlist); > > cmd->chanlist_len = v32.chanlist_len; > > cmd->data = compat_ptr(v32.data); > > cmd->data_len = v32.data_len; > > Always run your patches through checkpatch before sending them, so you > do not have a grumpy maintainer telling you that you have to run > checkpatch on your patch before sending them. I will, Sorry for that. But this particular error which showed up after running checkpatch is something 'git format-patch' does unintentionally. It has been reported to the maintainers. thanks, karthik
[PATCH] staging: comedi: comedi_fops.c: changed type in assignment to unsigned int *
fixed a sparse warning by changing the type in assignment from void [noderef] __user * to unsigned int * (different address space) Signed-off-by: B K Karthik --- drivers/staging/comedi/comedi_fops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 3f70e5dfac39..4cc012e231b7 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -2956,7 +2956,7 @@ static int get_compat_cmd(struct comedi_cmd *cmd, cmd->scan_end_arg = v32.scan_end_arg; cmd->stop_src = v32.stop_src; cmd->stop_arg = v32.stop_arg; - cmd->chanlist = compat_ptr(v32.chanlist); + cmd->chanlist = (unsigned int *) compat_ptr(v32.chanlist); cmd->chanlist_len = v32.chanlist_len; cmd->data = compat_ptr(v32.data); cmd->data_len = v32.data_len; -- 2.20.1 signature.asc Description: PGP signature
[PATCH v2] staging: media: atomisp: mark some csi_rx.c symbols static
changed symbols N_SHORT_PACKET_LUT_ENTRIES, N_LONG_PACKET_ENTRIES, N_CSI_RX_FE_CTRL_DLANES, N_CSI_RX_BE_SID_WIDTH to static because they were not declared earlier. Signed-off-by: B K Karthik --- .../media/atomisp/pci/css_2401_system/host/csi_rx.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c b/drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c index 8e661091f7d9..4d2076db1240 100644 --- a/drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c +++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c @@ -15,26 +15,26 @@ #include "system_global.h" -const u32 N_SHORT_PACKET_LUT_ENTRIES[N_CSI_RX_BACKEND_ID] = { +static const u32 N_SHORT_PACKET_LUT_ENTRIES[N_CSI_RX_BACKEND_ID] = { 4, /* 4 entries at CSI_RX_BACKEND0_ID*/ 4, /* 4 entries at CSI_RX_BACKEND1_ID*/ 4 /* 4 entries at CSI_RX_BACKEND2_ID*/ }; -const u32 N_LONG_PACKET_LUT_ENTRIES[N_CSI_RX_BACKEND_ID] = { +static const u32 N_LONG_PACKET_LUT_ENTRIES[N_CSI_RX_BACKEND_ID] = { 8, /* 8 entries at CSI_RX_BACKEND0_ID*/ 4, /* 4 entries at CSI_RX_BACKEND1_ID*/ 4 /* 4 entries at CSI_RX_BACKEND2_ID*/ }; -const u32 N_CSI_RX_FE_CTRL_DLANES[N_CSI_RX_FRONTEND_ID] = { +static const u32 N_CSI_RX_FE_CTRL_DLANES[N_CSI_RX_FRONTEND_ID] = { N_CSI_RX_DLANE_ID, /* 4 dlanes for CSI_RX_FR0NTEND0_ID */ N_CSI_RX_DLANE_ID, /* 4 dlanes for CSI_RX_FR0NTEND1_ID */ N_CSI_RX_DLANE_ID /* 4 dlanes for CSI_RX_FR0NTEND2_ID */ }; /* sid_width for CSI_RX_BACKEND_ID */ -const u32 N_CSI_RX_BE_SID_WIDTH[N_CSI_RX_BACKEND_ID] = { +static const u32 N_CSI_RX_BE_SID_WIDTH[N_CSI_RX_BACKEND_ID] = { 3, 2, 2 -- 2.20.1 signature.asc Description: PGP signature
[PATCH] drivers: staging: media: atomisp: pci: css_2401_system: host: csi_rx.c: fixed a sparse warning by making undeclared symbols static
changed symbols N_SHORT_PACKET_LUT_ENTRIES, N_LONG_PACKET_ENTRIES, N_CSI_RX_FE_CTRL_DLANES, N_CSI_RX_BE_SID_WIDTH to static because they were not declared earlier. Signed-off-by: B K Karthik --- .../media/atomisp/pci/css_2401_system/host/csi_rx.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c b/drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c index 8e661091f7d9..4d2076db1240 100644 --- a/drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c +++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c @@ -15,26 +15,26 @@ #include "system_global.h" -const u32 N_SHORT_PACKET_LUT_ENTRIES[N_CSI_RX_BACKEND_ID] = { +static const u32 N_SHORT_PACKET_LUT_ENTRIES[N_CSI_RX_BACKEND_ID] = { 4, /* 4 entries at CSI_RX_BACKEND0_ID*/ 4, /* 4 entries at CSI_RX_BACKEND1_ID*/ 4 /* 4 entries at CSI_RX_BACKEND2_ID*/ }; -const u32 N_LONG_PACKET_LUT_ENTRIES[N_CSI_RX_BACKEND_ID] = { +static const u32 N_LONG_PACKET_LUT_ENTRIES[N_CSI_RX_BACKEND_ID] = { 8, /* 8 entries at CSI_RX_BACKEND0_ID*/ 4, /* 4 entries at CSI_RX_BACKEND1_ID*/ 4 /* 4 entries at CSI_RX_BACKEND2_ID*/ }; -const u32 N_CSI_RX_FE_CTRL_DLANES[N_CSI_RX_FRONTEND_ID] = { +static const u32 N_CSI_RX_FE_CTRL_DLANES[N_CSI_RX_FRONTEND_ID] = { N_CSI_RX_DLANE_ID, /* 4 dlanes for CSI_RX_FR0NTEND0_ID */ N_CSI_RX_DLANE_ID, /* 4 dlanes for CSI_RX_FR0NTEND1_ID */ N_CSI_RX_DLANE_ID /* 4 dlanes for CSI_RX_FR0NTEND2_ID */ }; /* sid_width for CSI_RX_BACKEND_ID */ -const u32 N_CSI_RX_BE_SID_WIDTH[N_CSI_RX_BACKEND_ID] = { +static const u32 N_CSI_RX_BE_SID_WIDTH[N_CSI_RX_BACKEND_ID] = { 3, 2, 2 -- 2.20.1 signature.asc Description: PGP signature
[PATCH 2/2] staging: rtl8188eu: include: rtw_pwrctrl.h: fixed a blank space coding style issue.
add blank spaces to improve code readability. Signed-off-by: B K Karthik --- drivers/staging/rtl8188eu/include/rtw_pwrctrl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h b/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h index c89328142731..b4cf0f1ce6d3 100644 --- a/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h +++ b/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h @@ -84,7 +84,7 @@ struct reportpwrstate_parm { unsigned short rsvd; }; -#define LPS_DELAY_TIME (1*HZ) /* 1 sec */ +#define LPS_DELAY_TIME (1 * HZ) /* 1 sec */ #define EXE_PWR_NONE 0x01 #define EXE_PWR_IPS0x02 -- 2.20.1 signature.asc Description: PGP signature
[PATCH 1/2] staging: rtl8188eu: include: rtw_pwrctrl.h: fixed multiple parentheses coding style issues.
add parentheses since complex valued macros must be enclosed within parentheses. Signed-off-by: B K Karthik --- drivers/staging/rtl8188eu/include/rtw_pwrctrl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h b/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h index 404634999e35..c89328142731 100644 --- a/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h +++ b/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h @@ -84,7 +84,7 @@ struct reportpwrstate_parm { unsigned short rsvd; }; -#define LPS_DELAY_TIME 1*HZ /* 1 sec */ +#define LPS_DELAY_TIME (1*HZ) /* 1 sec */ #define EXE_PWR_NONE 0x01 #define EXE_PWR_IPS0x02 @@ -201,7 +201,7 @@ struct pwrctrl_priv { }; #define rtw_get_ips_mode_req(pwrctrlpriv) \ - (pwrctrlpriv)->ips_mode_req + ((pwrctrlpriv)->ips_mode_req) #define rtw_ips_mode_req(pwrctrlpriv, ips_mode) \ ((pwrctrlpriv)->ips_mode_req = (ips_mode)) -- 2.20.1 signature.asc Description: PGP signature
[PATCH] staging: rtl8188eu: include: rtw_recv.h: fixed a blank space coding style issue.
added blank spaces to improve code readability. Signed-off-by: B K Karthik --- drivers/staging/rtl8188eu/include/rtw_recv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h b/drivers/staging/rtl8188eu/include/rtw_recv.h index e383cb119e1b..b281b9e7fcea 100644 --- a/drivers/staging/rtl8188eu/include/rtw_recv.h +++ b/drivers/staging/rtl8188eu/include/rtw_recv.h @@ -13,7 +13,7 @@ #define NR_RECVFRAME 256 #define RXFRAME_ALIGN 8 -#define RXFRAME_ALIGN_SZ (1< signature.asc Description: PGP signature
[PATCH] staging: rtl8188eu: include: rtw_cmd.h: fixed a blank space coding style issue.
add blank spaces for improved code readability. Signed-off-by: B K Karthik --- drivers/staging/rtl8188eu/include/rtw_cmd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/include/rtw_cmd.h b/drivers/staging/rtl8188eu/include/rtw_cmd.h index fa5e212fc9e0..002a797c6d0a 100644 --- a/drivers/staging/rtl8188eu/include/rtw_cmd.h +++ b/drivers/staging/rtl8188eu/include/rtw_cmd.h @@ -115,7 +115,7 @@ struct setopmode_parm { */ #define RTW_SSID_SCAN_AMOUNT 9 /* for WEXT_CSCAN_AMOUNT 9 */ -#define RTW_CHANNEL_SCAN_AMOUNT (14+37) +#define RTW_CHANNEL_SCAN_AMOUNT (14 + 37) struct sitesurvey_parm { int scan_mode; /* active: 1, passive: 0 */ u8 ssid_num; -- 2.20.1 signature.asc Description: PGP signature
[PATCH] staging: rtl8188eu: include: rtl8188e_xmit.h: fixed multiple blank space coding style issues
added blank spaces to improve code readability. (coding style issue) Signed-off-by: B K Karthik --- drivers/staging/rtl8188eu/include/rtl8188e_xmit.h | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_xmit.h b/drivers/staging/rtl8188eu/include/rtl8188e_xmit.h index 49884cceb349..c115007d883d 100644 --- a/drivers/staging/rtl8188eu/include/rtl8188e_xmit.h +++ b/drivers/staging/rtl8188eu/include/rtl8188e_xmit.h @@ -30,11 +30,11 @@ #define SET_EARLYMODE_LEN2_1(__pAddr, __Value) \ SET_BITS_TO_LE_4BYTE(__pAddr, 28, 4, __Value) #define SET_EARLYMODE_LEN2_2(__pAddr, __Value) \ - SET_BITS_TO_LE_4BYTE(__pAddr+4, 0, 8, __Value) + SET_BITS_TO_LE_4BYTE(__pAddr + 4, 0, 8, __Value) #define SET_EARLYMODE_LEN3(__pAddr, __Value) \ - SET_BITS_TO_LE_4BYTE(__pAddr+4, 8, 12, __Value) + SET_BITS_TO_LE_4BYTE(__pAddr + 4, 8, 12, __Value) #define SET_EARLYMODE_LEN4(__pAddr, __Value) \ - SET_BITS_TO_LE_4BYTE(__pAddr+4, 20, 12, __Value) + SET_BITS_TO_LE_4BYTE(__pAddr + 4, 20, 12, __Value) /* */ /* defined for TX DESC Operation */ @@ -100,7 +100,7 @@ enum TXDESC_SC { #define txdesc_set_ccx_sw_88e(txdesc, value) \ do { \ - ((struct txdesc_88e *)(txdesc))->sw1 = (((value)>>8) & 0x0f); \ + ((struct txdesc_88e *)(txdesc))->sw1 = (((value) >> 8) & 0x0f); \ ((struct txdesc_88e *)(txdesc))->sw0 = ((value) & 0xff); \ } while (0) @@ -138,9 +138,9 @@ struct txrpt_ccx_88e { u8 sw0; }; -#define txrpt_ccx_sw_88e(txrpt_ccx) ((txrpt_ccx)->sw0 + ((txrpt_ccx)->sw1<<8)) +#define txrpt_ccx_sw_88e(txrpt_ccx) ((txrpt_ccx)->sw0 + ((txrpt_ccx)->sw1 << 8)) #define txrpt_ccx_qtime_88e(txrpt_ccx) \ - ((txrpt_ccx)->ccx_qtime0+((txrpt_ccx)->ccx_qtime1<<8)) + ((txrpt_ccx)->ccx_qtime0+((txrpt_ccx)->ccx_qtime1 << 8)) void rtl8188e_fill_fake_txdesc(struct adapter *padapter, u8 *pDesc, u32 BufferLen, u8 IsPsPoll, u8 IsBTQosNull); -- 2.20.1 signature.asc Description: PGP signature
[PATCH 2/2] staging: rtl8188eu: include: rtw_pwrctrl.h: fixed a blank space coding style issue.
add blank spaces to improve code readability. Signed-off-by: B K Karthik --- drivers/staging/rtl8188eu/include/rtw_pwrctrl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h b/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h index c89328142731..b4cf0f1ce6d3 100644 --- a/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h +++ b/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h @@ -84,7 +84,7 @@ struct reportpwrstate_parm { unsigned short rsvd; }; -#define LPS_DELAY_TIME (1*HZ) /* 1 sec */ +#define LPS_DELAY_TIME (1 * HZ) /* 1 sec */ #define EXE_PWR_NONE 0x01 #define EXE_PWR_IPS0x02 -- 2.20.1 signature.asc Description: PGP signature
[PATCH 1/2] staging: rtl8188eu: include: rtw_pwrctrl.h: fixed multiple parentheses coding style issues.
add parentheses since complex valued macros must be enclosed within parentheses. Signed-off-by: B K Karthik --- drivers/staging/rtl8188eu/include/rtw_pwrctrl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h b/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h index 404634999e35..c89328142731 100644 --- a/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h +++ b/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h @@ -84,7 +84,7 @@ struct reportpwrstate_parm { unsigned short rsvd; }; -#define LPS_DELAY_TIME 1*HZ /* 1 sec */ +#define LPS_DELAY_TIME (1*HZ) /* 1 sec */ #define EXE_PWR_NONE 0x01 #define EXE_PWR_IPS0x02 @@ -201,7 +201,7 @@ struct pwrctrl_priv { }; #define rtw_get_ips_mode_req(pwrctrlpriv) \ - (pwrctrlpriv)->ips_mode_req + ((pwrctrlpriv)->ips_mode_req) #define rtw_ips_mode_req(pwrctrlpriv, ips_mode) \ ((pwrctrlpriv)->ips_mode_req = (ips_mode)) -- 2.20.1 signature.asc Description: PGP signature
[PATCH] staging: rtl8188eu: include: rtl8188e_xmit.h: fixed multiple blank space coding style issues
added blank spaces to improve code readability. (coding style issue) Signed-off-by: B K Karthik --- drivers/staging/rtl8188eu/include/rtl8188e_xmit.h | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_xmit.h b/drivers/staging/rtl8188eu/include/rtl8188e_xmit.h index 49884cceb349..c115007d883d 100644 --- a/drivers/staging/rtl8188eu/include/rtl8188e_xmit.h +++ b/drivers/staging/rtl8188eu/include/rtl8188e_xmit.h @@ -30,11 +30,11 @@ #define SET_EARLYMODE_LEN2_1(__pAddr, __Value) \ SET_BITS_TO_LE_4BYTE(__pAddr, 28, 4, __Value) #define SET_EARLYMODE_LEN2_2(__pAddr, __Value) \ - SET_BITS_TO_LE_4BYTE(__pAddr+4, 0, 8, __Value) + SET_BITS_TO_LE_4BYTE(__pAddr + 4, 0, 8, __Value) #define SET_EARLYMODE_LEN3(__pAddr, __Value) \ - SET_BITS_TO_LE_4BYTE(__pAddr+4, 8, 12, __Value) + SET_BITS_TO_LE_4BYTE(__pAddr + 4, 8, 12, __Value) #define SET_EARLYMODE_LEN4(__pAddr, __Value) \ - SET_BITS_TO_LE_4BYTE(__pAddr+4, 20, 12, __Value) + SET_BITS_TO_LE_4BYTE(__pAddr + 4, 20, 12, __Value) /* */ /* defined for TX DESC Operation */ @@ -100,7 +100,7 @@ enum TXDESC_SC { #define txdesc_set_ccx_sw_88e(txdesc, value) \ do { \ - ((struct txdesc_88e *)(txdesc))->sw1 = (((value)>>8) & 0x0f); \ + ((struct txdesc_88e *)(txdesc))->sw1 = (((value) >> 8) & 0x0f); \ ((struct txdesc_88e *)(txdesc))->sw0 = ((value) & 0xff); \ } while (0) @@ -138,9 +138,9 @@ struct txrpt_ccx_88e { u8 sw0; }; -#define txrpt_ccx_sw_88e(txrpt_ccx) ((txrpt_ccx)->sw0 + ((txrpt_ccx)->sw1<<8)) +#define txrpt_ccx_sw_88e(txrpt_ccx) ((txrpt_ccx)->sw0 + ((txrpt_ccx)->sw1 << 8)) #define txrpt_ccx_qtime_88e(txrpt_ccx) \ - ((txrpt_ccx)->ccx_qtime0+((txrpt_ccx)->ccx_qtime1<<8)) + ((txrpt_ccx)->ccx_qtime0+((txrpt_ccx)->ccx_qtime1 << 8)) void rtl8188e_fill_fake_txdesc(struct adapter *padapter, u8 *pDesc, u32 BufferLen, u8 IsPsPoll, u8 IsBTQosNull); -- 2.20.1 signature.asc Description: PGP signature
[PATCH] staging: rtl8188eu: include: rtw_recv.h: fixed a blank space coding style issue.
added blank spaces to improve code readability. Signed-off-by: B K Karthik --- drivers/staging/rtl8188eu/include/rtw_recv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h b/drivers/staging/rtl8188eu/include/rtw_recv.h index e383cb119e1b..b281b9e7fcea 100644 --- a/drivers/staging/rtl8188eu/include/rtw_recv.h +++ b/drivers/staging/rtl8188eu/include/rtw_recv.h @@ -13,7 +13,7 @@ #define NR_RECVFRAME 256 #define RXFRAME_ALIGN 8 -#define RXFRAME_ALIGN_SZ (1< signature.asc Description: PGP signature
[PATCH 2/2] staging: rtl8188eu: include: rtw_pwrctrl.h: fixed a blank space coding style issue.
add blank spaces to improve code readability. Signed-off-by: B K Karthik --- drivers/staging/rtl8188eu/include/rtw_pwrctrl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h b/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h index c89328142731..b4cf0f1ce6d3 100644 --- a/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h +++ b/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h @@ -84,7 +84,7 @@ struct reportpwrstate_parm { unsigned short rsvd; }; -#define LPS_DELAY_TIME (1*HZ) /* 1 sec */ +#define LPS_DELAY_TIME (1 * HZ) /* 1 sec */ #define EXE_PWR_NONE 0x01 #define EXE_PWR_IPS0x02 -- 2.20.1 signature.asc Description: PGP signature
[PATCH 1/2] staging: rtl8188eu: include: rtw_pwrctrl.h: fixed multiple parentheses coding style issues.
add parentheses since complex valued macros must be enclosed within parentheses. Signed-off-by: B K Karthik --- drivers/staging/rtl8188eu/include/rtw_pwrctrl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h b/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h index 404634999e35..c89328142731 100644 --- a/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h +++ b/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h @@ -84,7 +84,7 @@ struct reportpwrstate_parm { unsigned short rsvd; }; -#define LPS_DELAY_TIME 1*HZ /* 1 sec */ +#define LPS_DELAY_TIME (i*HZ) /* 1 sec */ #define EXE_PWR_NONE 0x01 #define EXE_PWR_IPS0x02 @@ -201,7 +201,7 @@ struct pwrctrl_priv { }; #define rtw_get_ips_mode_req(pwrctrlpriv) \ - (pwrctrlpriv)->ips_mode_req + ((pwrctrlpriv)->ips_mode_req) #define rtw_ips_mode_req(pwrctrlpriv, ips_mode) \ ((pwrctrlpriv)->ips_mode_req = (ips_mode)) -- 2.20.1 signature.asc Description: PGP signature
[PATCH] staging: rtl8188eu: include: rtw_cmd.h: fixed a blank space coding style issue.
add blank spaces for improved code readability. Signed-off-by: B K Karthik --- drivers/staging/rtl8188eu/include/rtw_cmd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/include/rtw_cmd.h b/drivers/staging/rtl8188eu/include/rtw_cmd.h index fa5e212fc9e0..002a797c6d0a 100644 --- a/drivers/staging/rtl8188eu/include/rtw_cmd.h +++ b/drivers/staging/rtl8188eu/include/rtw_cmd.h @@ -115,7 +115,7 @@ struct setopmode_parm { */ #define RTW_SSID_SCAN_AMOUNT 9 /* for WEXT_CSCAN_AMOUNT 9 */ -#define RTW_CHANNEL_SCAN_AMOUNT (14+37) +#define RTW_CHANNEL_SCAN_AMOUNT (14 + 37) struct sitesurvey_parm { int scan_mode; /* active: 1, passive: 0 */ u8 ssid_num; -- 2.20.1 signature.asc Description: PGP signature
[PATCH] staging: rtl8188eu: include: rtl8188e_xmit.h: fixed multiple blank space coding style issues
added blank spaces to improve code readability. Signed-off-by: B K Karthik --- drivers/staging/rtl8188eu/include/rtl8188e_xmit.h | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_xmit.h b/drivers/staging/rtl8188eu/include/rtl8188e_xmit.h index 49884cceb349..c115007d883d 100644 --- a/drivers/staging/rtl8188eu/include/rtl8188e_xmit.h +++ b/drivers/staging/rtl8188eu/include/rtl8188e_xmit.h @@ -30,11 +30,11 @@ #define SET_EARLYMODE_LEN2_1(__pAddr, __Value) \ SET_BITS_TO_LE_4BYTE(__pAddr, 28, 4, __Value) #define SET_EARLYMODE_LEN2_2(__pAddr, __Value) \ - SET_BITS_TO_LE_4BYTE(__pAddr+4, 0, 8, __Value) + SET_BITS_TO_LE_4BYTE(__pAdd r +4, 0, 8, __Value) #define SET_EARLYMODE_LEN3(__pAddr, __Value) \ - SET_BITS_TO_LE_4BYTE(__pAddr+4, 8, 12, __Value) + SET_BITS_TO_LE_4BYTE(__pAddr + 4, 8, 12, __Value) #define SET_EARLYMODE_LEN4(__pAddr, __Value) \ - SET_BITS_TO_LE_4BYTE(__pAddr+4, 20, 12, __Value) + SET_BITS_TO_LE_4BYTE(__pAddr + 4, 20, 12, __Value) /* */ /* defined for TX DESC Operation */ @@ -100,7 +100,7 @@ enum TXDESC_SC { #define txdesc_set_ccx_sw_88e(txdesc, value) \ do { \ - ((struct txdesc_88e *)(txdesc))->sw1 = (((value)>>8) & 0x0f); \ + ((struct txdesc_88e *)(txdesc))->sw1 = (((value) >> 8) & 0x0f); \ ((struct txdesc_88e *)(txdesc))->sw0 = ((value) & 0xff); \ } while (0) @@ -138,9 +138,9 @@ struct txrpt_ccx_88e { u8 sw0; }; -#define txrpt_ccx_sw_88e(txrpt_ccx) ((txrpt_ccx)->sw0 + ((txrpt_ccx)->sw1<<8)) +#define txrpt_ccx_sw_88e(txrpt_ccx) ((txrpt_ccx)->sw0 + ((txrpt_ccx)->sw1 << 8)) #define txrpt_ccx_qtime_88e(txrpt_ccx) \ - ((txrpt_ccx)->ccx_qtime0+((txrpt_ccx)->ccx_qtime1<<8)) + ((txrpt_ccx)->ccx_qtime0+((txrpt_ccx)->ccx_qtime1 << 8)) void rtl8188e_fill_fake_txdesc(struct adapter *padapter, u8 *pDesc, u32 BufferLen, u8 IsPsPoll, u8 IsBTQosNull); -- 2.20.1 signature.asc Description: PGP signature
[PATCH] staging: rtl8188eu: include: hal8188e_rate_adaptive.h: fixed a blank space coding style issue
added blank space around arithmetic operators to improve readability Signed-off-by: B K Karthik --- .../rtl8188eu/include/hal8188e_rate_adaptive.h | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rtl8188eu/include/hal8188e_rate_adaptive.h b/drivers/staging/rtl8188eu/include/hal8188e_rate_adaptive.h index 5b59c25e4c8a..79c0d2f9961e 100644 --- a/drivers/staging/rtl8188eu/include/hal8188e_rate_adaptive.h +++ b/drivers/staging/rtl8188eu/include/hal8188e_rate_adaptive.h @@ -35,17 +35,17 @@ #define GET_TX_REPORT_TYPE1_RERTY_0(__pAddr) \ LE_BITS_TO_4BYTE(__pAddr, 0, 16) #define GET_TX_REPORT_TYPE1_RERTY_1(__pAddr) \ - LE_BITS_TO_1BYTE(__pAddr+2, 0, 8) + LE_BITS_TO_1BYTE(__pAddr + 2, 0, 8) #define GET_TX_REPORT_TYPE1_RERTY_2(__pAddr) \ - LE_BITS_TO_1BYTE(__pAddr+3, 0, 8) + LE_BITS_TO_1BYTE(__pAddr + 3, 0, 8) #define GET_TX_REPORT_TYPE1_RERTY_3(__pAddr) \ - LE_BITS_TO_1BYTE(__pAddr+4, 0, 8) + LE_BITS_TO_1BYTE(__pAddr + 4, 0, 8) #define GET_TX_REPORT_TYPE1_RERTY_4(__pAddr) \ - LE_BITS_TO_1BYTE(__pAddr+4+1, 0, 8) + LE_BITS_TO_1BYTE(__pAddr + 4 + 1, 0, 8) #define GET_TX_REPORT_TYPE1_DROP_0(__pAddr)\ - LE_BITS_TO_1BYTE(__pAddr+4+2, 0, 8) + LE_BITS_TO_1BYTE(__pAddr + 4 + 2, 0, 8) #define GET_TX_REPORT_TYPE1_DROP_1(__pAddr)\ - LE_BITS_TO_1BYTE(__pAddr+4+3, 0, 8) + LE_BITS_TO_1BYTE(__pAddr + 4 + 3, 0, 8) /* End rate adaptive define */ -- 2.20.1 signature.asc Description: PGP signature
[PATCH] staging: rtl8188eu: include: odm.h: fixed a blank space coding style issue.
added blank space and enclosed a complex valued macro within parentheses for improved code readability. Signed-off-by: B K Karthik --- drivers/staging/rtl8188eu/include/odm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/include/odm.h b/drivers/staging/rtl8188eu/include/odm.h index 9d39fe13626a..27bffc2ead66 100644 --- a/drivers/staging/rtl8188eu/include/odm.h +++ b/drivers/staging/rtl8188eu/include/odm.h @@ -244,7 +244,7 @@ struct odm_rate_adapt { #define AVG_THERMAL_NUM8 #define IQK_Matrix_REG_NUM 8 -#define IQK_Matrix_Settings_NUM1+24+21 +#define IQK_Matrix_Settings_NUM(1 + 24 + 21) #defineDM_Type_ByFWi 0 #defineDM_Type_ByDriver1 -- 2.20.1 signature.asc Description: PGP signature
Re: [PATCH] staging: media: atomisp: i2c: atomisp-ov2680.c: fixed a brace coding style issue.
Did this get burried in along with a bunch of other patches? I am sending this email only because I did not recieve a negetive acknowledgement on the patch. I apologize if this message was hurtful / disrespectfull in any manner, thank you for reading this message. karthik On 20/06/28 12:38AM, B K Karthik wrote: > Fixed a coding style issue. > > Signed-off-by: B K Karthik > --- > drivers/staging/media/atomisp/i2c/atomisp-ov2680.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c > b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c > index 90d125ba080f..c90730513438 100644 > --- a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c > +++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c > @@ -495,11 +495,11 @@ static int ov2680_h_flip(struct v4l2_subdev *sd, s32 > value) > ret = ov2680_read_reg(client, 1, OV2680_MIRROR_REG, ); > if (ret) > return ret; > - if (value) { > + if (value) > val |= OV2680_FLIP_MIRROR_BIT_ENABLE; > - } else { > + else > val &= ~OV2680_FLIP_MIRROR_BIT_ENABLE; > - } > + > ret = ov2680_write_reg(client, 1, > OV2680_MIRROR_REG, val); > if (ret) > -- > 2.20.1 signature.asc Description: PGP signature
[PATCH] staging: rtl8188eu: include: ieee80211.h: fixed multiple blank line coding style issues.
removed multiple blank lines to improve code readability. Signed-off-by: B K Karthik --- drivers/staging/rtl8188eu/include/ieee80211.h | 9 - 1 file changed, 9 deletions(-) diff --git a/drivers/staging/rtl8188eu/include/ieee80211.h b/drivers/staging/rtl8188eu/include/ieee80211.h index 75f0ebe0faf5..93fd0e9c49dc 100644 --- a/drivers/staging/rtl8188eu/include/ieee80211.h +++ b/drivers/staging/rtl8188eu/include/ieee80211.h @@ -90,7 +90,6 @@ enum { #define IEEE_CRYPT_ERR_TX_KEY_SET_FAILED 6 #define IEEE_CRYPT_ERR_CARD_CONF_FAILED7 - #defineIEEE_CRYPT_ALG_NAME_LEN 16 #define WPA_CIPHER_NONEBIT(0) @@ -99,8 +98,6 @@ enum { #define WPA_CIPHER_TKIPBIT(3) #define WPA_CIPHER_CCMPBIT(4) - - #define WPA_SELECTOR_LEN 4 extern u8 RTW_WPA_OUI_TYPE[]; extern u8 WPA_AUTH_KEY_MGMT_NONE[]; @@ -113,7 +110,6 @@ extern u8 WPA_CIPHER_SUITE_WRAP[]; extern u8 WPA_CIPHER_SUITE_CCMP[]; extern u8 WPA_CIPHER_SUITE_WEP104[]; - #define RSN_HEADER_LEN 4 #define RSN_SELECTOR_LEN 4 @@ -192,7 +188,6 @@ enum NETWORK_TYPE { #define IsSupportedTxMCS(NetType) \ ((NetType) & (WIRELESS_11_24N | WIRELESS_11_5N) ? true : false) - struct ieee_param { u32 cmd; u8 sta_addr[ETH_ALEN]; @@ -270,11 +265,9 @@ struct sta_data { * WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */ - #define IEEE80211_HLEN 30 #define IEEE80211_FRAME_LEN(IEEE80211_DATA_LEN + IEEE80211_HLEN) - /* this is stolen from ipw2200 driver */ #define IEEE_IBSS_MAC_HASH_SIZE 31 @@ -297,7 +290,6 @@ enum eap_type { #define RTW_IEEE80211_SCTL_FRAG0x000F #define RTW_IEEE80211_SCTL_SEQ 0xFFF0 - #define RTW_ERP_INFO_NON_ERP_PRESENT BIT(0) #define RTW_ERP_INFO_USE_PROTECTION BIT(1) #define RTW_ERP_INFO_BARKER_PREAMBLE_MODE BIT(2) @@ -354,7 +346,6 @@ struct ieee80211_snap_hdr { #define IEEE80211_CCK_RATE_LEN 4 #define IEEE80211_NUM_OFDM_RATESLEN8 - #define IEEE80211_CCK_RATE_1MB 0x02 #define IEEE80211_CCK_RATE_2MB 0x04 #define IEEE80211_CCK_RATE_5MB 0x0B -- 2.20.1 signature.asc Description: PGP signature
[REPORT] False positive errors found while using scripts/checkpatch.pl
The following are reported while using checkpatch.pl on drivers/staging/fbtft/fbtft-bus.c ERROR: space prohibited before that close parenthesis ')' #65: FILE: drivers/staging/fbtft/fbtft-bus.c:65: +define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8, ) ERROR: space prohibited before that close parenthesis ')' #67: FILE: drivers/staging/fbtft/fbtft-bus.c:67: +define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, u16, ) These are false positives as correcting these issues breaks the build. signature.asc Description: PGP signature
[PATCH] init: main.c: Fixed a brace coding style issue.
Fixed a coding style issue. Signed-off-by: B K Karthik --- init/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/init/main.c b/init/main.c index 9127b240fd26..d8477fb95bec 100644 --- a/init/main.c +++ b/init/main.c @@ -385,11 +385,11 @@ static u32 boot_config_checksum(unsigned char *p, u32 size) static int __init bootconfig_params(char *param, char *val, const char *unused, void *arg) { - if (strcmp(param, "bootconfig") == 0) { + if (strcmp(param, "bootconfig") == 0) bootconfig_found = true; - } else if (strcmp(param, "--") == 0) { + else if (strcmp(param, "--") == 0) initargs_found = true; - } + return 0; } -- 2.20.1 signature.asc Description: PGP signature
[PATCH] staging: media: atomisp: i2c: atomisp-ov2680.c: fixed a brace coding style issue.
Fixed a coding style issue. Signed-off-by: B K Karthik --- drivers/staging/media/atomisp/i2c/atomisp-ov2680.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c index 90d125ba080f..c90730513438 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c @@ -495,11 +495,11 @@ static int ov2680_h_flip(struct v4l2_subdev *sd, s32 value) ret = ov2680_read_reg(client, 1, OV2680_MIRROR_REG, ); if (ret) return ret; - if (value) { + if (value) val |= OV2680_FLIP_MIRROR_BIT_ENABLE; - } else { + else val &= ~OV2680_FLIP_MIRROR_BIT_ENABLE; - } + ret = ov2680_write_reg(client, 1, OV2680_MIRROR_REG, val); if (ret) -- 2.20.1 signature.asc Description: PGP signature
Re: [PATCH] staging: media: usbvision: removing prohibited space before ',' (ctx:WxW)
Thank you for the information. I will take care of all these things from the next time. sorry for wasting your time thanks, karthik On Sat, Jun 27, 2020 at 4:49 AM Greg Kroah-Hartman wrote: > > On Sat, Jun 27, 2020 at 10:28:31AM +0200, Hans Verkuil wrote: > > On 27/06/2020 07:07, Greg Kroah-Hartman wrote: > > > > > > A: http://en.wikipedia.org/wiki/Top_post > > > Q: Were do I find info about this thing called top-posting? > > > A: Because it messes up the order in which people normally read text. > > > Q: Why is top-posting such a bad thing? > > > A: Top-posting. > > > Q: What is the most annoying thing in e-mail? > > > > > > A: No. > > > Q: Should I include quotations after my reply? > > > > > > http://daringfireball.net/2007/07/on_top > > > > > > On Fri, Jun 26, 2020 at 11:42:49AM -0400, B K KARTHIK > > > PES2201800185STUDENT ECE DeptPESU EC Campus wrote: > > >> Oh, I'm sorry but wouldn't it be helpful if we had a file that lists > > >> all drivers that are scheduled for removal? > > > > > > The TODO file in the directory for the driver should have this > > > information in it. I don't know if all of the media drivers have this, > > > if not, then there is no way you could have known this. > > > > They have, and in addition the Kconfig entry will mention that the driver > > is deprecated. > > > > TODO of usbvision: > > > > The driver is deprecated and scheduled for removal by the end > > of 2020. > > > > In order to prevent removal the following actions would have to > > be taken: > > > > - clean up the code > > - convert to the vb2 framework > > - fix the disconnect and free-on-last-user handling (i.e., add > > a release callback for struct v4l2_device and rework the code > > to use that correctly). > > Ah, great, nevermind then! > > B K, your wish is already granted, the text is present, you just needed > to have noticed it :) > > greg k-h
[PATCH] staging: rtl8712: rtl8712_recv.h: Removing unnecessary blank line
Removing unnecessary blank line Signed-off-by: B K Karthik --- drivers/staging/rtl8712/rtl8712_recv.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/rtl8712/rtl8712_recv.h b/drivers/staging/rtl8712/rtl8712_recv.h index 3e385b2242d8..69d3d5b287d3 100644 --- a/drivers/staging/rtl8712/rtl8712_recv.h +++ b/drivers/staging/rtl8712/rtl8712_recv.h @@ -84,7 +84,6 @@ union recvstat { unsigned int value[RXDESC_SIZE>>2]; }; - struct recv_buf { struct list_head list; spinlock_t recvbuf_lock; -- 2.20.1 signature.asc Description: PGP signature
[PATCH] qlge.h: Adding the missing blank line after declarations
Signed-off-by: B K Karthik --- drivers/staging/qlge/qlge.h | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/qlge/qlge.h b/drivers/staging/qlge/qlge.h index fc8c5ca8935d..0b971a633001 100644 --- a/drivers/staging/qlge/qlge.h +++ b/drivers/staging/qlge/qlge.h @@ -2224,6 +2224,7 @@ static inline void ql_write_db_reg_relaxed(u32 val, void __iomem *addr) static inline u32 ql_read_sh_reg(__le32 *addr) { u32 reg; + reg = le32_to_cpu(*addr); rmb(); return reg; -- 2.20.1 signature.asc Description: PGP signature
[PATCH] fbtft-bus.c: Removing that prohibited space before ')'
fbtft-bus.c: fixing ERROR: space prohibited before that close parenthesis ')' by removing that space and ',' in line 65 and 67. Signed-off-by: B K Karthik --- drivers/staging/fbtft/fbtft-bus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/fbtft/fbtft-bus.c b/drivers/staging/fbtft/fbtft-bus.c index 63c65dd67b17..847cbfbbd766 100644 --- a/drivers/staging/fbtft/fbtft-bus.c +++ b/drivers/staging/fbtft/fbtft-bus.c @@ -62,9 +62,9 @@ out: \ } \ EXPORT_SYMBOL(func); -define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8, ) +define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8) define_fbtft_write_reg(fbtft_write_reg16_bus8, __be16, u16, cpu_to_be16) -define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, u16, ) +define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, u16) void fbtft_write_reg8_bus9(struct fbtft_par *par, int len, ...) { -- 2.20.1 signature.asc Description: PGP signature
[PATCH] fbtft-bus.c:
fbtft-bus.c: fixing ERROR: space prohibited before that close parenthesis ')' by removing that space and ',' in line 65 and 67. Signed-off-by: B K Karthik --- drivers/staging/fbtft/fbtft-bus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/fbtft/fbtft-bus.c b/drivers/staging/fbtft/fbtft-bus.c index 63c65dd67b17..847cbfbbd766 100644 --- a/drivers/staging/fbtft/fbtft-bus.c +++ b/drivers/staging/fbtft/fbtft-bus.c @@ -62,9 +62,9 @@ out: \ } \ EXPORT_SYMBOL(func); -define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8, ) +define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8) define_fbtft_write_reg(fbtft_write_reg16_bus8, __be16, u16, cpu_to_be16) -define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, u16, ) +define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, u16) void fbtft_write_reg8_bus9(struct fbtft_par *par, int len, ...) { -- 2.20.1 signature.asc Description: PGP signature
Re: [PATCH] staging: media: usbvision: removing prohibited space before ',' (ctx:WxW)
Oh, I'm sorry but wouldn't it be helpful if we had a file that lists all drivers that are scheduled for removal? I personally feel that it would help out all kernel newbies. I've been trying to complete task10 in the eudyptula challenge, and the patches either get thrown out by greg's patch-bot, or the driver is scheduled for removal. Please do think about adding a file that lists all drivers scheduled for removal. I apologize if my message was hurtful or disrespectful in any way. Thank you for reading this message, Karthik On Fri, Jun 26, 2020 at 10:32 AM B K Karthik wrote: > > fixing ERROR: space prohibited before that ',' (ctx:WxW) > > Signed-off-by: B K Karthik > --- > drivers/staging/media/usbvision/usbvision-i2c.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/media/usbvision/usbvision-i2c.c > b/drivers/staging/media/usbvision/usbvision-i2c.c > index 6e4df3335b1b..010ad03c6ec1 100644 > --- a/drivers/staging/media/usbvision/usbvision-i2c.c > +++ b/drivers/staging/media/usbvision/usbvision-i2c.c > @@ -32,7 +32,7 @@ MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); > #define PDEBUG(level, fmt, args...) { \ > if (i2c_debug & (level)) \ > printk(KERN_INFO KBUILD_MODNAME ":[%s:%d] " fmt, \ > - __func__, __LINE__ , ## args); \ > + __func__, __LINE__, ## args); \ > } > > static int usbvision_i2c_write(struct usb_usbvision *usbvision, unsigned > char addr, char *buf, > -- > 2.20.1 > -- B K Karthik 9535399755 karthik.oncreate.team
[PATCH] staging: media: usbvision: removing prohibited space before ',' (ctx:WxW)
fixing ERROR: space prohibited before that ',' (ctx:WxW) Signed-off-by: B K Karthik --- drivers/staging/media/usbvision/usbvision-i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/usbvision/usbvision-i2c.c b/drivers/staging/media/usbvision/usbvision-i2c.c index 6e4df3335b1b..010ad03c6ec1 100644 --- a/drivers/staging/media/usbvision/usbvision-i2c.c +++ b/drivers/staging/media/usbvision/usbvision-i2c.c @@ -32,7 +32,7 @@ MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); #define PDEBUG(level, fmt, args...) { \ if (i2c_debug & (level)) \ printk(KERN_INFO KBUILD_MODNAME ":[%s:%d] " fmt, \ - __func__, __LINE__ , ## args); \ + __func__, __LINE__, ## args); \ } static int usbvision_i2c_write(struct usb_usbvision *usbvision, unsigned char addr, char *buf, -- 2.20.1 signature.asc Description: PGP signature
[PATCH] fixing ERROR: Macros with complex values must be enclosed within parentheses.
soc_camera.c: fixing ERROR: Macros with complex values must be enclused within parentheses. Signed-off-by: B K Karthik --- drivers/staging/media/soc_camera/soc_camera.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/media/soc_camera/soc_camera.c b/drivers/staging/media/soc_camera/soc_camera.c index 39f513f69b89..f609ecf6691c 100644 --- a/drivers/staging/media/soc_camera/soc_camera.c +++ b/drivers/staging/media/soc_camera/soc_camera.c @@ -238,8 +238,7 @@ unsigned long soc_camera_apply_board_flags(struct soc_camera_subdev_desc *ssdd, } EXPORT_SYMBOL(soc_camera_apply_board_flags); -#define pixfmtstr(x) (x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, \ - ((x) >> 24) & 0xff +#define pixfmtstr(x) ((x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, ((x) >> 24) & 0xff) static int soc_camera_try_fmt(struct soc_camera_device *icd, struct v4l2_format *f) -- 2.20.1 signature.asc Description: PGP signature
[PATCH 1/1] staging: media: soc_camera: Adding parentheses to macro defination at line 241, Clearing alignment issues at lines 410 and 1270, fixing return values at EPOLLERR
staging: media: soc_camera: soc_camera.c: Clearing coding-style problem "Macros with complex values should be enclosed in parentheses" in line 241 by adding parentheses. staging: media: soc_camera: soc_camera.c: Clearing coding-style problem "Alignment should match open parenthesis" by adding tab spaces in line 410. staging: media: soc_camera: soc_camera.c: Clearing coding-style problem "return of an errno should typically be negative" by adding a "-" in front of EPOLLER in line 812. staging: media: soc_camera: soc_camera.c: Clearing coding-style problem "Alignment should match open parenthesis" by adding tab spaces in line 1270. Signed-off-by: B K Karthik --- drivers/staging/media/soc_camera/soc_camera.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/media/soc_camera/soc_camera.c b/drivers/staging/media/soc_camera/soc_camera.c index 39f513f69b89..66a14ebd8093 100644 --- a/drivers/staging/media/soc_camera/soc_camera.c +++ b/drivers/staging/media/soc_camera/soc_camera.c @@ -238,8 +238,8 @@ unsigned long soc_camera_apply_board_flags(struct soc_camera_subdev_desc *ssdd, } EXPORT_SYMBOL(soc_camera_apply_board_flags); -#define pixfmtstr(x) (x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, \ - ((x) >> 24) & 0xff +#define pixfmtstr(x) ((x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, \ + ((x) >> 24) & 0xff) static int soc_camera_try_fmt(struct soc_camera_device *icd, struct v4l2_format *f) @@ -407,7 +407,7 @@ static int soc_camera_dqbuf(struct file *file, void *priv, } static int soc_camera_create_bufs(struct file *file, void *priv, - struct v4l2_create_buffers *create) + struct v4l2_create_buffers *create) { struct soc_camera_device *icd = file->private_data; int ret; @@ -806,10 +806,10 @@ static __poll_t soc_camera_poll(struct file *file, poll_table *pt) { struct soc_camera_device *icd = file->private_data; struct soc_camera_host *ici = to_soc_camera_host(icd->parent); - __poll_t res = EPOLLERR; + __poll_t res = -EPOLLERR; if (icd->streamer != file) - return EPOLLERR; + return -EPOLLERR; mutex_lock(>host_lock); res = ici->ops->poll(file, pt); @@ -1267,7 +1267,7 @@ static int soc_camera_i2c_init(struct soc_camera_device *icd, } subdev = v4l2_i2c_new_subdev_board(>v4l2_dev, adap, - shd->board_info, NULL); + shd->board_info, NULL); if (!subdev) { ret = -ENODEV; goto ei2cnd; -- 2.20.1 signature.asc Description: PGP signature
[PATCH] staging: nvec: changed coding style, line should not end with a (
Signed-off-by: B K Karthik --- drivers/staging/nvec/nvec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c index 360ec0407740..16afbe1dfdeb 100644 --- a/drivers/staging/nvec/nvec.c +++ b/drivers/staging/nvec/nvec.c @@ -382,8 +382,8 @@ static void nvec_request_master(struct work_struct *work) msg = list_first_entry(>tx_data, struct nvec_msg, node); spin_unlock_irqrestore(>tx_lock, flags); nvec_gpio_set_value(nvec, 0); - err = wait_for_completion_interruptible_timeout( - >ec_transfer, msecs_to_jiffies(5000)); + err = wait_for_completion_interruptible_timeout(>ec_transfer, + msecs_to_jiffies(5000)); if (err == 0) { dev_warn(nvec->dev, "timeout waiting for ec transfer\n"); -- 2.20.1 signature.asc Description: PGP signature