From patchwork Fri Feb 2 15:19:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10197017 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F184260388 for ; Fri, 2 Feb 2018 15:20:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0A1F28E9F for ; Fri, 2 Feb 2018 15:20:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D49D128EBA; Fri, 2 Feb 2018 15:20:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2522528EB6 for ; Fri, 2 Feb 2018 15:20:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751835AbeBBPUZ (ORCPT ); Fri, 2 Feb 2018 10:20:25 -0500 Received: from mout.kundenserver.de ([217.72.192.75]:60498 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751710AbeBBPUY (ORCPT ); Fri, 2 Feb 2018 10:20:24 -0500 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.145]) with ESMTPA (Nemesis) id 0MaD2e-1eSJCl3tMm-00JoHl; Fri, 02 Feb 2018 16:20:12 +0100 From: Arnd Bergmann To: Alan Cox , Sakari Ailus , Mauro Carvalho Chehab , Greg Kroah-Hartman Cc: Arnd Bergmann , =?UTF-8?q?J=C3=A9r=C3=A9my=20Lefaure?= , Sergiy Redko , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: media: atomisp: remove pointless string copy Date: Fri, 2 Feb 2018 16:19:41 +0100 Message-Id: <20180202152009.843231-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:YwOaRFH0AilTCNdPNOQMzYA7Jmbl3dUcB6knq81TLO9t3aXQ/Mi Kcwdn00c2u2opFWSHAX92GuLY2GfsBa5OTkS4ReGB7M936bGDkyR+UweNVC6zvo313MiVp0 5c4hG1UojGhFrGvZAsTVzbnX6pT1GQhiUwHWi/y1VpE8+TZZmrBzGLUPhhRT6q6RW5zhsuG wqmlVn9KQxxAOoTcQ+d4Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:IdYRcOVakjM=:f9E+5x3G0tXpo7SSOOWGPj ZO56+7bLEoMBO5m7yI1dpYkCxlGHk9XvbmFf5z5+bfzAUuUsizgfdqKI9fbjLzzt5vCTPmDLB aXFWyN5oK3vw9Ns5uSvJ8FGiBh4wpI2YoC9I39fl4tlSnEjy/Vh3sUX+xE6o+qy8mlaP3AaUc vI3AbKnJRFsuzf3b6atfpOs3UNBYNRs1iJcVFlbqL+2lDyegxWFLOcHKXUfKWE4NlcpbUPh6j RRyIH3gPIQue5dIJZ+VaW57F7ag0mAXz6wonIcGqOl8mNT0aIpO9t75w/PZ3s+EcSe/luZW72 TE4rqnENbSeN9yPsIuGwJh92VReRi3FwvhK5/PZ5lCGAsnVeTbI+aU5HuKXgoIObVbHS0dk7X O9naRLXzokiK/4nxGbyJHAj7YNaoMf4fjIqqYYJWqLPlcfE9AImtx8bKhqCgmgLLYyUIqvjnG FYLmOAdjM502kVu7RFAFh9xv4n76fdizshOrOgo/7MuImUVQxNQsCLYfeDi3yVU3+l8BaurMT t6SIdpgyhNpkS6cFANcncUyki3JD45RK1G89Zp8OP0tibtynfBhHMyFMp924DeLiYt5Xr3BFO BiSjO2Ecn/QIy6vN7R41i2WqlDhWgKiV35AHa0nW1YeRKBvB5xZdZg9Cd/Q6YPyAfnIDwLl8D 2RtCzq0R5bWTK3wakOMGLbTaJ/pdP1bFxNijt3otvsbRavF3bzAmzisAj5L4h8KAGYxYtTDMa RJbc2C/MWAc2TygSnWDYArJ+tqB8b7dIUofNhw== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP gcc-8 points out that a string is copied to itself here: In file included from drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/platform_support.h:25, from drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/memory_access/memory_access.h:48, from drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c:16: In function 'strncpy', inlined from 'ia_css_debug_pipe_graph_dump_stage' at drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h:158:2: include/linux/string.h:253:9: error: '__builtin_strncpy' source argument is the same as destination [-Werror=restrict] return __builtin_strncpy(p, q, size); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This removes the bogus code, leaving the behavior otherwise unchanged. Signed-off-by: Arnd Bergmann --- .../atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c index f22d73b56bc6..60395904f89a 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c @@ -2858,13 +2858,7 @@ ia_css_debug_pipe_graph_dump_stage( if (l && enable_info[l-1] == ',') enable_info[--l] = '\0'; - if (l <= ENABLE_LINE_MAX_LENGTH) { - /* It fits on one line, copy string and init */ - /* other helper strings with empty string */ - strcpy_s(enable_info, - sizeof(enable_info), - ei); - } else { + if (l > ENABLE_LINE_MAX_LENGTH) { /* Too big for one line, find last comma */ p = ENABLE_LINE_MAX_LENGTH; while (ei[p] != ',')