From: Kulikov Vasiliy Date: Sat, 17 Jul 2010 15:19:48 +0000 (+0400) Subject: dma: dmatest: fix potential sign bug X-Git-Tag: v2.6.36-rc1~311^2~2 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9033e682e86f3c6a66763f9b6a3935c5c64e145;p=pandora-kernel.git dma: dmatest: fix potential sign bug 'cnt' is unsigned, so this code may become wrong in future as dmatest_add_threads() can return error code: cnt = dmatest_add_threads(dtc, DMA_MEMCPY); thread_count += cnt > 0 ? cnt : 0; ^^^^^^^ Now it can return only -EINVAL if and only if second argument of dmatest_add_threads() is not one of DMA_MEMCPY, DMA_XOR, DMA_PQ. So, now it is not wrong but may become wrong in future. The semantic patch that finds this problem (many false-positive results): (http://coccinelle.lip6.fr/) // @ r1 @ identifier f; @@ int f(...) { ... } @@ identifier r1.f; type T; unsigned T x; @@ *x = f(...) ... *x > 0 Signed-off-by: Kulikov Vasiliy Signed-off-by: Dan Williams --- Reading git-diff-tree failed