Null stack variables before use
authornorly <ny-git@enpas.org>
Thu, 14 Feb 2019 18:22:20 +0000 (19:22 +0100)
committernorly <ny-git@enpas.org>
Sun, 17 Feb 2019 23:48:47 +0000 (00:48 +0100)
module/elmcan.c

index 3724d97fdc7b763a1229a955e29e8704cbbe62eb..1c1465f1a570bed53d1c9ad6515315438db6c73a 100644 (file)
@@ -335,8 +335,9 @@ static void elm327_feed_frame_to_netdev(struct elmcan *elm, const struct can_fra
 /* Called when we're out of ideas and just want it all to end. */
 static inline void elm327_hw_failure(struct elmcan *elm)
 {
-       struct can_frame frame = {0};
+       struct can_frame frame;
 
+       memset(&frame, 0, sizeof(frame));
        frame.can_id = CAN_ERR_FLAG;
        frame.can_dlc = CAN_ERR_DLC;
        frame.data[5] = 'R';
@@ -361,8 +362,9 @@ static inline void elm327_hw_failure(struct elmcan *elm)
 
 static void elm327_parse_error(struct elmcan *elm, int len)
 {
-       struct can_frame frame = {0};
+       struct can_frame frame;
 
+       memset(&frame, 0, sizeof(frame));
        frame.can_id = CAN_ERR_FLAG;
        frame.can_dlc = CAN_ERR_DLC;
 
@@ -420,11 +422,13 @@ static void elm327_parse_error(struct elmcan *elm, int len)
 
 static int elm327_parse_frame(struct elmcan *elm, int len)
 {
-       struct can_frame frame = {0};
+       struct can_frame frame;
        int hexlen;
        int datastart;
        int i;
 
+       memset(&frame, 0, sizeof(frame));
+
        /* Find first non-hex and non-space character:
         *  - In the simplest case, there is none.
         *  - For RTR frames, 'R' is the first non-hex character.