Re: [kbuild] [linux-next:master 6222/11392] drivers/tty/serial/fsl_linflexuart.c:278 linflex_rxint() warn: curly braces intended?

2019-09-06 Thread Dan Carpenter
On Fri, Sep 06, 2019 at 06:10:43PM +, Stefan-gabriel Mirea wrote:
> As to the other warnings:
> 
> > drivers/tty/serial/fsl_linflexuart.c:626 linflex_earlycon_putchar() error: 
> > we previously assumed 'earlycon_buf.content' could be null (see line 614)
> 

Yeah...  :/

I'm not totally sure what went wrong here.  Smatch is supposed to be
able to parse this code correctly to know that it's non-NULL.  It's
working fine when I do it on my system.  I recently fixed a bunch of
bugs though so maybe that fixed the problem.

regards,
dan carpenter

___
kbuild mailing list
kbuild@lists.01.org
https://lists.01.org/mailman/listinfo/kbuild


[kbuild] [cifs:for-next 15/15] fs/cifs/transport.c:1247 SendReceive() warn: variable dereferenced before check 'ses' (see line 1245)

2019-09-06 Thread Dan Carpenter
tree:   git://git.samba.org/sfrench/cifs-2.6.git for-next
head:   2808c6639104c5aea1fccdf692deab0ccf00914f
commit: 2808c6639104c5aea1fccdf692deab0ccf00914f [15/15] cifs: add new 
debugging macro cifs_server_dbg

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 
Reported-by: Dan Carpenter 

New smatch warnings:
fs/cifs/transport.c:1247 SendReceive() warn: variable dereferenced before check 
'ses' (see line 1245)
fs/cifs/transport.c:1342 SendReceive() warn: inconsistent returns 
'mutex:>server->srv_mutex'.
  Locked on:   line 1249
  Unlocked on: line 1284
fs/cifs/transport.c:1342 SendReceive() warn: inconsistent returns 
'mutex:>srv_mutex'.
  Locked on:   line 1284
  Unlocked on: line 1249
fs/cifs/smb2pdu.c:2763 SMB2_ioctl() warn: variable dereferenced before check 
'ses' (see line 2762)
fs/cifs/smb2pdu.c:3067 query_info() warn: variable dereferenced before check 
'ses' (see line 3061)

git remote add cifs git://git.samba.org/sfrench/cifs-2.6.git
git remote update cifs
git checkout 2808c6639104c5aea1fccdf692deab0ccf00914f
vim +/ses +1247 fs/cifs/transport.c

96daf2b09178d8 Steve French2011-05-27  1235  SendReceive(const unsigned int 
xid, struct cifs_ses *ses,
^1da177e4c3f41 Linus Torvalds  2005-04-16  1236 struct smb_hdr 
*in_buf, struct smb_hdr *out_buf,
480b1cb9dad894 Ronnie Sahlberg 2019-03-08  1237 int 
*pbytes_returned, const int flags)
^1da177e4c3f41 Linus Torvalds  2005-04-16  1238  {
^1da177e4c3f41 Linus Torvalds  2005-04-16  1239 int rc = 0;
^1da177e4c3f41 Linus Torvalds  2005-04-16  1240 struct mid_q_entry 
*midQ;
fb2036d817584d Pavel Shilovsky 2016-11-23  1241 unsigned int len = 
be32_to_cpu(in_buf->smb_buf_length);
fb2036d817584d Pavel Shilovsky 2016-11-23  1242 struct kvec iov = { 
.iov_base = in_buf, .iov_len = len };
fb2036d817584d Pavel Shilovsky 2016-11-23  1243 struct smb_rqst rqst = 
{ .rq_iov = , .rq_nvec = 1 };
34f4deb7c56c6f Pavel Shilovsky 2019-01-16  1244 struct cifs_credits 
credits = { .value = 1, .instance = 0 };
2808c6639104c5 Ronnie Sahlberg 2019-08-28 @1245 struct TCP_Server_Info 
*server = ses->server;

 ^^^
Dereference

^1da177e4c3f41 Linus Torvalds  2005-04-16  1246  
^1da177e4c3f41 Linus Torvalds  2005-04-16 @1247 if (ses == NULL) {
^^^
Check

f96637be081141 Joe Perches 2013-05-04  1248 cifs_dbg(VFS, 
"Null smb session\n");
^1da177e4c3f41 Linus Torvalds  2005-04-16  1249 return -EIO;
^1da177e4c3f41 Linus Torvalds  2005-04-16  1250 }
2808c6639104c5 Ronnie Sahlberg 2019-08-28  1251 if (server == NULL) {
f96637be081141 Joe Perches 2013-05-04  1252 cifs_dbg(VFS, 
"Null tcp session\n");
^1da177e4c3f41 Linus Torvalds  2005-04-16  1253 return -EIO;
^1da177e4c3f41 Linus Torvalds  2005-04-16  1254 }
^1da177e4c3f41 Linus Torvalds  2005-04-16  1255  
2808c6639104c5 Ronnie Sahlberg 2019-08-28  1256 if (server->tcpStatus 
== CifsExiting)
31ca3bc3c569f9 Steve French2005-04-28  1257 return -ENOENT;
31ca3bc3c569f9 Steve French2005-04-28  1258  
^1da177e4c3f41 Linus Torvalds  2005-04-16  1259 /* Ensure that we do 
not send more than 50 overlapping requests
^1da177e4c3f41 Linus Torvalds  2005-04-16  1260to the same server. 
We may make this configurable later or
^1da177e4c3f41 Linus Torvalds  2005-04-16  1261use ses->maxReq */
^1da177e4c3f41 Linus Torvalds  2005-04-16  1262  
fb2036d817584d Pavel Shilovsky 2016-11-23  1263 if (len > 
CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) {
2808c6639104c5 Ronnie Sahlberg 2019-08-28  1264 
cifs_server_dbg(VFS, "Illegal length, greater than maximum frame, %d\n",
fb2036d817584d Pavel Shilovsky 2016-11-23  1265  len);
6d9c6d543165d1 Volker Lendecke 2008-12-08  1266 return -EIO;
6d9c6d543165d1 Volker Lendecke 2008-12-08  1267 }
6d9c6d543165d1 Volker Lendecke 2008-12-08  1268  
2808c6639104c5 Ronnie Sahlberg 2019-08-28  1269 rc = 
wait_for_free_request(server, flags, );
7ee1af765dfa31 Jeremy Allison  2006-08-02  1270 if (rc)
7ee1af765dfa31 Jeremy Allison  2006-08-02  1271 return rc;
^1da177e4c3f41 Linus Torvalds  2005-04-16  1272  
^1da177e4c3f41 Linus Torvalds  2005-04-16  1273 /* make sure that we 
sign in the same order that we send on this socket
^1da177e4c3f41 Linus Torvalds  2005-04-16  1274and avoid races 
inside tcp sendmsg code that could cause corruption
^1da177e4c3f41 Linus Torvalds  2005-04-16  1275of smb data */
^1da177e4c3f41 Linus Torvalds  2005-04-16  1276  
2808c6639104c5 Ronnie Sahlberg 2019-08-28  1277 
mutex_lock(>srv_mutex);
^1da177e4c3f41 Linus Torvalds  

[kbuild] [linux-next:master 6222/11392] drivers/tty/serial/fsl_linflexuart.c:278 linflex_rxint() warn: curly braces intended?

2019-09-06 Thread Dan Carpenter
tree:   
https://kernel.googlesource.com/pub/scm/linux/kernel/git/next/linux-next.git 
master
head:   35394d031b710e832849fca60d0f53b513f0c390
commit: b953815b819b0f327b5538feba3639d52db70172 [6222/11392] tty: serial: Add 
linflexuart driver for S32V234

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 
Reported-by: Dan Carpenter 

smatch warnings:
drivers/tty/serial/fsl_linflexuart.c:278 linflex_rxint() warn: curly braces 
intended?
drivers/tty/serial/fsl_linflexuart.c:626 linflex_earlycon_putchar() error: we 
previously assumed 'earlycon_buf.content' could be null (see line 614)
drivers/tty/serial/fsl_linflexuart.c:759 linflex_console_setup() error: we 
previously assumed 'earlycon_port' could be null (see line 733)

git remote add linux-next 
https://kernel.googlesource.com/pub/scm/linux/kernel/git/next/linux-next.git
git remote update linux-next
git checkout b953815b819b0f327b5538feba3639d52db70172
vim +278 drivers/tty/serial/fsl_linflexuart.c

b953815b819b0f Stefan-gabriel Mirea 2019-08-09  252 status = 
readl(sport->membase + UARTSR);
b953815b819b0f Stefan-gabriel Mirea 2019-08-09  253 while (status & 
LINFLEXD_UARTSR_RMB) {
b953815b819b0f Stefan-gabriel Mirea 2019-08-09  254 rx = 
readb(sport->membase + BDRM);
b953815b819b0f Stefan-gabriel Mirea 2019-08-09  255 flg = 
TTY_NORMAL;
b953815b819b0f Stefan-gabriel Mirea 2019-08-09  256 
sport->icount.rx++;
b953815b819b0f Stefan-gabriel Mirea 2019-08-09  257  
b953815b819b0f Stefan-gabriel Mirea 2019-08-09  258 if (status & 
(LINFLEXD_UARTSR_BOF | LINFLEXD_UARTSR_SZF |
b953815b819b0f Stefan-gabriel Mirea 2019-08-09  259   
LINFLEXD_UARTSR_FEF | LINFLEXD_UARTSR_PE)) {
b953815b819b0f Stefan-gabriel Mirea 2019-08-09  260 if 
(status & LINFLEXD_UARTSR_SZF)
b953815b819b0f Stefan-gabriel Mirea 2019-08-09  261 
status |= LINFLEXD_UARTSR_SZF;
b953815b819b0f Stefan-gabriel Mirea 2019-08-09  262 if 
(status & LINFLEXD_UARTSR_BOF)
b953815b819b0f Stefan-gabriel Mirea 2019-08-09  263 
status |= LINFLEXD_UARTSR_BOF;
b953815b819b0f Stefan-gabriel Mirea 2019-08-09  264 if 
(status & LINFLEXD_UARTSR_FEF)
b953815b819b0f Stefan-gabriel Mirea 2019-08-09  265 
status |= LINFLEXD_UARTSR_FEF;
b953815b819b0f Stefan-gabriel Mirea 2019-08-09  266 if 
(status & LINFLEXD_UARTSR_PE)
b953815b819b0f Stefan-gabriel Mirea 2019-08-09  267 
status |=  LINFLEXD_UARTSR_PE;
b953815b819b0f Stefan-gabriel Mirea 2019-08-09  268 }
b953815b819b0f Stefan-gabriel Mirea 2019-08-09  269  
b953815b819b0f Stefan-gabriel Mirea 2019-08-09  270 writel(status | 
LINFLEXD_UARTSR_RMB | LINFLEXD_UARTSR_DRFRFE,
b953815b819b0f Stefan-gabriel Mirea 2019-08-09  271
sport->membase + UARTSR);
b953815b819b0f Stefan-gabriel Mirea 2019-08-09  272 status = 
readl(sport->membase + UARTSR);
b953815b819b0f Stefan-gabriel Mirea 2019-08-09  273  
b953815b819b0f Stefan-gabriel Mirea 2019-08-09  274 if 
(uart_handle_sysrq_char(sport, (unsigned char)rx))
b953815b819b0f Stefan-gabriel Mirea 2019-08-09  275 
continue;
b953815b819b0f Stefan-gabriel Mirea 2019-08-09  276  
b953815b819b0f Stefan-gabriel Mirea 2019-08-09  277  #ifdef SUPPORT_SYSRQ
b953815b819b0f Stefan-gabriel Mirea 2019-08-09 @278 
sport->sysrq = 0;

The indenting is wrong here?  Or should it go before the continue?

b953815b819b0f Stefan-gabriel Mirea 2019-08-09  279  #endif
b953815b819b0f Stefan-gabriel Mirea 2019-08-09  280 
tty_insert_flip_char(port, rx, flg);
b953815b819b0f Stefan-gabriel Mirea 2019-08-09  281 }

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation
___
kbuild mailing list
kbuild@lists.01.org
https://lists.01.org/mailman/listinfo/kbuild