Re: [PATCH v2] IB/rdmavt: Fix variable shadowing issue in rvt_create_cq

From: Nick Desaulniers
Date: Tue Jul 09 2019 - 19:16:52 EST


On Tue, Jul 9, 2019 at 4:06 PM Nathan Chancellor
<natechancellor@xxxxxxxxx> wrote:
> The function scoped err variable is uninitialized when the flow jumps
> into the if statement. The if scoped err variable shadows the function
> scoped err variable, preventing the err assignments within the if
> statement to be reflected at the function level, which will cause
> uninitialized use when the goto statements are taken.
>
> Just remove the if scoped err declaration so that there is only one
> copy of the err variable for this function.
>
> Fixes: 239b0e52d8aa ("IB/hfi1: Move rvt_cq_wc struct into uapi directory")
> Link: https://github.com/ClangBuiltLinux/linux/issues/594
> Reviewed-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
> Signed-off-by: Nathan Chancellor <natechancellor@xxxxxxxxx>
> ---
>
> v1 -> v2:
>
> * Updated the wording of the commit message to use proper terms like
> scoping and shadowing, thanks to review from Nick (let me know if the
> wording isn't up to snuff).

LGTM thanks for following up w/ v2.
--
Thanks,
~Nick Desaulniers