Re: [PATCHv3 for-next 18/19] block/rnbd-clt-sysfs: Remove copy buffer overlap in rnbd_clt_get_path_name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 6, 2021 at 9:07 AM Gioh Kim <gi-oh.kim@xxxxxxxxx> wrote:
>
> From: Dima Stepanov <dmitrii.stepanov@xxxxxxxxxxxxxxx>
>
> cppcheck report the following error:
>   rnbd/rnbd-clt-sysfs.c:522:36: error: The variable 'buf' is used both
>   as a parameter and as destination in snprintf(). The origin and
>   destination buffers overlap. Quote from glibc (C-library)
>   documentation
>   (http://www.gnu.org/software/libc/manual/html_mono/libc.html#Formatted-Output-Functions):
>   "If copying takes place between objects that overlap as a result of a
>   call to sprintf() or snprintf(), the results are undefined."
>   [sprintfOverlappingData]
> Fix it by initializing the buf variable in the first snprintf call.
>
> Fixes: 91f4acb2801c ("block/rnbd-clt: support mapping two devices")
> Signed-off-by: Dima Stepanov <dmitrii.stepanov@xxxxxxxxx>
> Cc: Arnd Bergmann <arnd@xxxxxxxx>
> Signed-off-by: Jack Wang <jinpu.wang@xxxxxxxxx>
+ Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@xxxxxxx>



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux