Re: check idea: warn when mixing signedness in ?: operator (got bitten by this recently)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dan,

Dan Carpenter <dan.carpenter@xxxxxxxxxx> writes:
> Thanks for the idea.  I can implement something like that in Smatch.
> I'll run the attached check over the kernel and see what it turns up.

I've only used sparse I think (make C=1) I need to lookup how to use Smatch.

> It says that it's only checking assignments but the trick is that
> Smatch creates fake assignments in the background for passing parameters
> or returning.  So "return a ? uint_val : -ENOMEM;" will trigger an error
> message.

Sounds good.

> If there are too many false positives when I test this tonight, then I
> may make is_suspicious_int() more strict.

If that's any help, the exact bug where we hit this is currently in
fs/cifs/file.c in collect_uncached_write_data(), this line:

	ctx->rc = (rc == 0) ? ctx->total_len : rc;

Hopefully it shows up in your tests.        

Cheers,
-- 
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)





[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux