Skip to content

Commit 805cdb8

Browse files
committed
drbd: Remove uninitialized_var() usage
Using uninitialized_var() is dangerous as it papers over real bugs[1] (or can in the future), and suppresses unrelated compiler warnings (e.g. "unused variable"). If the compiler thinks it is uninitialized, either simply initialize the variable or make compiler changes. As a precursor to removing[2] this[3] macro[4], just initialize this variable to NULL. [1] https://lore.kernel.org/lkml/[email protected]/ [2] https://lore.kernel.org/lkml/CA+55aFw+Vbj0i=1TGqCR5vQkCzWJ0QxK6CernOU6eedsudAixw@mail.gmail.com/ [3] https://lore.kernel.org/lkml/CA+55aFwgbgqhbp1fkxvRKEpzyR5J8n1vKT1VZdz9knmPuXhOeg@mail.gmail.com/ [4] https://lore.kernel.org/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yVJu65TpLgN_ybYNv0VEOKA@mail.gmail.com/ Fixes: a297284 ("drbd: Backport the "events2" command") Reviewed-by: Nick Desaulniers <[email protected]> Signed-off-by: Kees Cook <[email protected]>
1 parent aecfd22 commit 805cdb8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/block/drbd/drbd_state.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1604,7 +1604,7 @@ static void broadcast_state_change(struct drbd_state_change *state_change)
16041604
unsigned int n_device, n_connection, n_peer_device, n_peer_devices;
16051605
void (*last_func)(struct sk_buff *, unsigned int, void *,
16061606
enum drbd_notification_type) = NULL;
1607-
void *uninitialized_var(last_arg);
1607+
void *last_arg = NULL;
16081608

16091609
#define HAS_CHANGED(state) ((state)[OLD] != (state)[NEW])
16101610
#define FINAL_STATE_CHANGE(type) \

0 commit comments

Comments
 (0)