lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 16 Nov 2020 17:27:42 -0800
From:   Jakub Kicinski <kuba@...nel.org>
To:     <min.li.xe@...esas.com>
Cc:     <richardcochran@...il.com>, <netdev@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next 1/5] ptp: clockmatrix: bug fix for
 idtcm_strverscmp

On Mon, 16 Nov 2020 14:27:26 -0500 min.li.xe@...esas.com wrote:
> From: Min Li <min.li.xe@...esas.com>
> 
> Feed kstrtou8 with NULL terminated string.

Is this a fix? Does it need to be backported to stable?

Also please add a cover letter for the series describing the overall
goal of this work, what testing has been done etc.

>  drivers/ptp/ptp_clockmatrix.c | 52 +++++++++++++++++++++++++++++++------------
>  1 file changed, 38 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/ptp/ptp_clockmatrix.c b/drivers/ptp/ptp_clockmatrix.c
> index e020faf..bf2be50 100644
> --- a/drivers/ptp/ptp_clockmatrix.c
> +++ b/drivers/ptp/ptp_clockmatrix.c
> @@ -103,42 +103,66 @@ static int timespec_to_char_array(struct timespec64 const *ts,
>  	return 0;
>  }
>  
> -static int idtcm_strverscmp(const char *ver1, const char *ver2)
> +static int idtcm_strverscmp(const char *version1, const char *version2)
>  {
>  	u8 num1;
>  	u8 num2;
>  	int result = 0;
> +	char ver1[16];
> +	char ver2[16];
> +	char *cur1;
> +	char *cur2;
> +	char *next1;
> +	char *next2;
> +
> +	strncpy(ver1, version1, 16);
> +	strncpy(ver2, version2, 16);

This patch triggers the following warning on a 32bit build:

In file included from ../arch/x86/include/asm/page_32.h:35,
                 from ../arch/x86/include/asm/page.h:14,
                 from ../arch/x86/include/asm/thread_info.h:12,
                 from ../include/linux/thread_info.h:38,
                 from ../arch/x86/include/asm/preempt.h:7,
                 from ../include/linux/preempt.h:78,
                 from ../include/linux/spinlock.h:51,
                 from ../include/linux/mmzone.h:8,
                 from ../include/linux/gfp.h:6,
                 from ../include/linux/firmware.h:7,
                 from ../drivers/ptp/ptp_clockmatrix.c:8:
In function ‘strncpy’,
    inlined from ‘idtcm_strverscmp.constprop’ at ../drivers/ptp/ptp_clockmatrix.c:118:2:
../include/linux/string.h:290:30: warning: ‘__builtin_strncpy’ specified bound 16 equals destination size [-Wstringop-truncation]
  290 | #define __underlying_strncpy __builtin_strncpy
      |                              ^
../include/linux/string.h:300:9: note: in expansion of macro ‘__underlying_strncpy’
  300 |  return __underlying_strncpy(p, q, size);
      |         ^~~~~~~~~~~~~~~~~~~~

Powered by blists - more mailing lists