aboutsummaryrefslogtreecommitdiffstats
path: root/build-root
diff options
context:
space:
mode:
authorChris Luke <chrisy@flirble.org>2017-05-23 11:46:52 -0400
committerNeale Ranns <nranns@cisco.com>2017-05-24 07:39:43 +0000
commitaaeb341086b99ae01a133fd0b56fb3f881f36e44 (patch)
tree9f347ad22ebc3ae0a3288aea7299e90b094ab519 /build-root
parent3060e07b71fd4dd6203769d73c4f8f21709f9b9c (diff)
Simple script to 'git blame' on new Coverity issues
- Pass an email in to stdin and the script produces output similar to: Hi, Please find the latest report on new defect(s) introduced to fd.io VPP found with Coverity Scan. New defect(s) Reported-by: Coverity Scan Showing 2 of 2 defect(s) ** CID 167726: Resource leaks (RESOURCE_LEAK) /src/vnet/devices/af_packet/device.c: 215 in af_packet_interface_admin_up_down() ________________________________________________________________________________________________________ *** CID 167726: Resource leaks (RESOURCE_LEAK) /src/vnet/devices/af_packet/device.c: 215 in af_packet_interface_admin_up_down() >>> CID 167726: Resource leaks (RESOURCE_LEAK) >>> Handle variable "fd" going out of scope leaks the handle. 00a9dcad vnet/vnet/devices/af_packet/device.c (Damjan Marion 2016-08-17 209) af_packet_if_t *apif = 00a9dcad vnet/vnet/devices/af_packet/device.c (Damjan Marion 2016-08-17 210) pool_elt_at_index (apm->interfaces, hw->dev_instance); 83cc4e14 vnet/vnet/devices/af_packet/device.c (Alpesh Patel 2016-04-05 211) u32 hw_flags; c855b73f src/vnet/devices/af_packet/device.c (Ray Kinsella 2017-04-21 212) int rv, fd = socket (AF_UNIX, SOCK_DGRAM, 0); c855b73f src/vnet/devices/af_packet/device.c (Ray Kinsella 2017-04-21 213) struct ifreq ifr; c855b73f src/vnet/devices/af_packet/device.c (Ray Kinsella 2017-04-21 214) c855b73f src/vnet/devices/af_packet/device.c (Ray Kinsella 2017-04-21 215) /* if interface is a bridge ignore */ c855b73f src/vnet/devices/af_packet/device.c (Ray Kinsella 2017-04-21 216) if (apif->host_if_index < 0) 2038ad01 src/vnet/devices/af_packet/device.c (Ray Kinsella 2017-05-18 217) goto error; /* no error */ c855b73f src/vnet/devices/af_packet/device.c (Ray Kinsella 2017-04-21 218) c855b73f src/vnet/devices/af_packet/device.c (Ray Kinsella 2017-04-21 219) /* use host_if_index in case host name has changed */ c855b73f src/vnet/devices/af_packet/device.c (Ray Kinsella 2017-04-21 220) ifr.ifr_ifindex = apif->host_if_index; ** CID 167725: Error handling issues (NEGATIVE_RETURNS) /src/vnet/devices/af_packet/device.c: 252 in af_packet_interface_admin_up_down() ________________________________________________________________________________________________________ *** CID 167725: Error handling issues (NEGATIVE_RETURNS) /src/vnet/devices/af_packet/device.c: 252 in af_packet_interface_admin_up_down() >>> CID 167725: Error handling issues (NEGATIVE_RETURNS) >>> "fd" is passed to a parameter that cannot be negative. c855b73f src/vnet/devices/af_packet/device.c (Ray Kinsella 2017-04-21 246) } c855b73f src/vnet/devices/af_packet/device.c (Ray Kinsella 2017-04-21 247) c855b73f src/vnet/devices/af_packet/device.c (Ray Kinsella 2017-04-21 248) if ((rv = ioctl (fd, SIOCSIFFLAGS, &ifr)) < 0) c855b73f src/vnet/devices/af_packet/device.c (Ray Kinsella 2017-04-21 249) { c855b73f src/vnet/devices/af_packet/device.c (Ray Kinsella 2017-04-21 250) clib_unix_warning ("af_packet_%s error: %d", c855b73f src/vnet/devices/af_packet/device.c (Ray Kinsella 2017-04-21 251) apif->is_admin_up ? "up" : "down", rv); 2038ad01 src/vnet/devices/af_packet/device.c (Ray Kinsella 2017-05-18 252) goto error; c855b73f src/vnet/devices/af_packet/device.c (Ray Kinsella 2017-04-21 253) } 83cc4e14 vnet/vnet/devices/af_packet/device.c (Alpesh Patel 2016-04-05 254) 00a9dcad vnet/vnet/devices/af_packet/device.c (Damjan Marion 2016-08-17 255) vnet_hw_interface_set_flags (vnm, hw_if_index, hw_flags); 83cc4e14 vnet/vnet/devices/af_packet/device.c (Alpesh Patel 2016-04-05 256) 2038ad01 src/vnet/devices/af_packet/device.c (Ray Kinsella 2017-05-18 257) error: Change-Id: I9756c16ea24e7520704155ae1f6c5f132087e3bc Signed-off-by: Chris Luke <chrisy@flirble.org>
Diffstat (limited to 'build-root')
-rwxr-xr-xbuild-root/scripts/coverity-blame.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/build-root/scripts/coverity-blame.sh b/build-root/scripts/coverity-blame.sh
new file mode 100755
index 00000000000..8775ea48d99
--- /dev/null
+++ b/build-root/scripts/coverity-blame.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+# Read coverity email on stdin
+# whenever we find a filename & line number reference, go git-blame it
+
+file=
+start=
+end=
+
+while read line; do
+ if echo "$line" | grep -q '^/.*: '; then
+ echo "$line"
+ file=$(echo "$line" | cut -d: -f1)
+ elif echo "$line" | grep -q '^[*]'; then
+ echo "$line"
+ file=
+ start=
+ end=
+ elif echo "$line" | grep -q '^[0-9][0-9]*'; then
+ num=$(echo "$line" | awk '{print $1}')
+ [ -z "$start" ] && start=$num
+ #git blame -L "$num,+1" ".$file" | cat
+ elif [ -z "$line" ]; then
+ if [ "$start" -a "$num" -a "$file" ]; then
+ end=$num
+ git blame --date=short -L "$start,$end" ".$file" | cat
+ start=
+ end=
+ num=
+ else
+ echo "$line"
+ fi
+ else
+ echo "$line"
+ fi
+done