From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3963CC3F68F for ; Thu, 19 Dec 2019 00:46:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 19C1E24650 for ; Thu, 19 Dec 2019 00:46:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726623AbfLSAqA (ORCPT ); Wed, 18 Dec 2019 19:46:00 -0500 Received: from relmlor2.renesas.com ([210.160.252.172]:63416 "EHLO relmlie6.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726518AbfLSAqA (ORCPT ); Wed, 18 Dec 2019 19:46:00 -0500 Date: 19 Dec 2019 09:45:58 +0900 X-IronPort-AV: E=Sophos;i="5.69,330,1571670000"; d="scan'208";a="34574760" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 19 Dec 2019 09:45:58 +0900 Received: from morimoto-PC.renesas.com (unknown [10.166.18.140]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 6FC8440FD785; Thu, 19 Dec 2019 09:45:58 +0900 (JST) Message-ID: <87zhfpywft.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: Geert Uytterhoeven Cc: Karl Nasrallah , Yoshinori Sato , Rich Felker , Linux-SH , Linux-Renesas , "open list:KERNEL SELFTEST FRAMEWORK" Subject: Re: [PATCH] sh: use generic strncpy() In-Reply-To: References: <878snajjh2.wl-kuninori.morimoto.gx@renesas.com> User-Agent: Wanderlust/2.15.9 Emacs/24.5 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Hi Geert Thank you for your review > > But, current SH strnpy() has 2 issues. > > 1st is it will access to out-of-memory (= src + 10). > > I believe this is not correct: the code does not really access memory > beyond the end of the source string. (Recent) gcc just thinks so, > because "__src+__n" is used as a parameter to the routine. I see. Will fix in v2 Thank you for your help !! Best regards --- Kuninori Morimoto