]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
media: staging: media: atomisp: remove pointless string copy
authorArnd Bergmann <arnd@arndb.de>
Fri, 2 Feb 2018 15:19:41 +0000 (10:19 -0500)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Wed, 21 Mar 2018 19:32:19 +0000 (15:32 -0400)
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 <arnd@arndb.de>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c

index f22d73b56bc63e7302cd34d1f7f6caccb905a57c..60395904f89a8bca1edfc176dda8a09f67909f39 100644 (file)
@@ -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] != ',')