From: Andrey Utkin Date: Thu, 17 Jul 2014 16:27:16 +0000 (-0300) Subject: [media] staging/media/davinci_vpfe/dm365_ipipeif.c: fix negativity check X-Git-Tag: omap-for-v3.17/fixes-against-rc2~155^2~265 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7fcec4c14b15684b0853c9ebc4090c19adc9a1f6;p=pandora-kernel.git [media] staging/media/davinci_vpfe/dm365_ipipeif.c: fix negativity check [linux-3.16-rc5/drivers/staging/media/davinci_vpfe/dm365_ipipeif.c:210]: (style) Checking if unsigned variable 'val' is less than zero. val = get_oneshot_mode(ipipeif->input); if (val < 0) { pr_err("ipipeif: links setup required"); return -EINVAL; } but static int get_oneshot_mode(enum ipipeif_input_entity input) Introduced temporary variable for negativity check. "val" is afterwards used in a lot of bitwise operations, so changing its type to signed is not safe, according to CERT C Secure Coding Standards chapter INT13-C: "Use bitwise operators only on unsigned operands" https://www.securecoding.cert.org/confluence/display/seccode/INT13-C.+Use+bitwise+operators+only+on+unsigned+operands Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=80521 Reported-by: David Binderman Signed-off-by: Andrey Utkin Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Reading git-diff-tree failed