Whamcloud - gitweb
LU-11233 build: support for gcc8 02/35002/2
authorAlex Zhuravlev <bzzz@whamcloud.com>
Mon, 15 Apr 2019 12:58:59 +0000 (15:58 +0300)
committerOleg Drokin <green@whamcloud.com>
Sat, 8 Jun 2019 02:38:39 +0000 (02:38 +0000)
this patch covers kernel portion of Lustre

Lustre-change: https://review.whamcloud.com/34660
Lustre-commit: 6601661f96325b4971d0d1cb0be0fa01cc2ddc97

Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Change-Id: I3fac8b89eef2291b5cb91ea05ee0b6ff32d11741
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Signed-off-by: Minh Diep <mdiep@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/35002
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
config/lustre-build.m4
lustre/lmv/lmv_obd.c
lustre/mgs/mgs_handler.c
lustre/obdclass/genops.c
lustre/osd-ldiskfs/osd_handler.c
lustre/ptlrpc/nodemap_storage.c
lustre/quota/qsd_lib.c

index 7fec7bb..d64ce8a 100644 (file)
@@ -362,6 +362,50 @@ AC_DEFUN([LB_CC_NO_FORMAT_TRUNCATION], [
 ])
 
 #
 ])
 
 #
+# Check if gcc supports -Wno-stringop-truncation
+#
+# To supress many warnings with gcc8
+#
+AC_DEFUN([LB_CC_NO_STRINGOP_TRUNCATION], [
+       AC_MSG_CHECKING([for -Wno-stringop-truncation support])
+
+       saved_flags="$CFLAGS"
+       CFLAGS="$CFLAGS -Wno-stringop-truncation"
+
+       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [
+               EXTRA_KCFLAGS="$EXTRA_KCFLAGS -Wno-stringop-truncation"
+               AC_SUBST(EXTRA_KCFLAGS)
+               AC_MSG_RESULT([yes])
+       ], [
+               AC_MSG_RESULT([no])
+       ])
+
+       CFLAGS="$saved_flags"
+])
+
+#
+# Check if gcc supports -Wno-stringop-overflow
+#
+# To supress many warnings with gcc8
+#
+AC_DEFUN([LB_CC_NO_STRINGOP_OVERFLOW], [
+       AC_MSG_CHECKING([for -Wno-stringop-overflow support])
+
+       saved_flags="$CFLAGS"
+       CFLAGS="$CFLAGS -Wno-stringop-overflow"
+
+       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [
+               EXTRA_KCFLAGS="$EXTRA_KCFLAGS -Wno-stringop-overflow"
+               AC_SUBST(EXTRA_KCFLAGS)
+               AC_MSG_RESULT([yes])
+       ], [
+               AC_MSG_RESULT([no])
+       ])
+
+       CFLAGS="$saved_flags"
+])
+
+#
 # LB_CONDITIONALS
 #
 # AM_CONDITIONAL instances for everything
 # LB_CONDITIONALS
 #
 # AM_CONDITIONAL instances for everything
@@ -583,6 +627,8 @@ LB_PATH_DEFAULTS
 
 LB_PROG_CC
 LB_CC_NO_FORMAT_TRUNCATION
 
 LB_PROG_CC
 LB_CC_NO_FORMAT_TRUNCATION
+LB_CC_NO_STRINGOP_TRUNCATION
+LB_CC_NO_STRINGOP_OVERFLOW
 
 LC_OSD_ADDON
 
 
 LC_OSD_ADDON
 
index 3337fb8..ae8c83f 100644 (file)
@@ -659,6 +659,7 @@ repeat_fid2path:
        if (remote_gf != NULL) {
                struct getinfo_fid2path *ori_gf;
                char *ptr;
        if (remote_gf != NULL) {
                struct getinfo_fid2path *ori_gf;
                char *ptr;
+               int len;
 
                ori_gf = (struct getinfo_fid2path *)karg;
                if (strlen(ori_gf->gf_u.gf_path) + 1 +
 
                ori_gf = (struct getinfo_fid2path *)karg;
                if (strlen(ori_gf->gf_u.gf_path) + 1 +
@@ -667,13 +668,12 @@ repeat_fid2path:
 
                ptr = ori_gf->gf_u.gf_path;
 
 
                ptr = ori_gf->gf_u.gf_path;
 
-               memmove(ptr + strlen(gf->gf_u.gf_path) + 1, ptr,
-                       strlen(ori_gf->gf_u.gf_path));
-
-               strncpy(ptr, gf->gf_u.gf_path,
-                       strlen(gf->gf_u.gf_path));
-               ptr += strlen(gf->gf_u.gf_path);
-               *ptr = '/';
+               len = strlen(gf->gf_u.gf_path);
+               /* move the current path to the right to release space
+                * for closer-to-root part */
+               memmove(ptr + len + 1, ptr, strlen(ori_gf->gf_u.gf_path));
+               memcpy(ptr, gf->gf_u.gf_path, len);
+               ptr[len] = '/';
        }
 
        CDEBUG(D_INFO, "%s: get path %s "DFID" rec: %llu ln: %u\n",
        }
 
        CDEBUG(D_INFO, "%s: get path %s "DFID" rec: %llu ln: %u\n",
index 096c27e..bc14d4e 100644 (file)
@@ -742,7 +742,7 @@ static int mgs_extract_fs_pool(char *arg, char *fsname, char *poolname)
        /* Also make sure poolname is not to long. */
        if (strlen(ptr) > LOV_MAXPOOLNAME)
                return -ENAMETOOLONG;
        /* Also make sure poolname is not to long. */
        if (strlen(ptr) > LOV_MAXPOOLNAME)
                return -ENAMETOOLONG;
-       strncpy(poolname, ptr, strlen(ptr));
+       strncpy(poolname, ptr, LOV_MAXPOOLNAME);
 
        /* Test if fsname is empty */
        len = strlen(arg) - strlen(ptr) - 1;
 
        /* Test if fsname is empty */
        len = strlen(arg) - strlen(ptr) - 1;
index 2bfa781..9c71703 100644 (file)
@@ -445,7 +445,7 @@ struct obd_device *class_newdev(const char *type_name, const char *name,
 
        newdev->obd_conn_inprogress = 0;
 
 
        newdev->obd_conn_inprogress = 0;
 
-       strncpy(newdev->obd_uuid.uuid, uuid, strlen(uuid));
+       strncpy(newdev->obd_uuid.uuid, uuid, UUID_MAX);
 
        CDEBUG(D_IOCTL, "Allocate new device %s (%p)\n",
               newdev->obd_name, newdev);
 
        CDEBUG(D_IOCTL, "Allocate new device %s (%p)\n",
               newdev->obd_name, newdev);
index 27d02f7..26e5480 100644 (file)
@@ -7585,7 +7585,7 @@ static int osd_mount(const struct lu_env *env,
                        "force_over_512tb",
                        NULL
                };
                        "force_over_512tb",
                        NULL
                };
-               strcat(options, opts);
+               strncat(options, opts, PAGE_SIZE);
                for (rc = 0, str = options; sout[rc]; ) {
                        char *op = strstr(str, sout[rc]);
 
                for (rc = 0, str = options; sout[rc]; ) {
                        char *op = strstr(str, sout[rc]);
 
@@ -7605,13 +7605,13 @@ static int osd_mount(const struct lu_env *env,
                                ;
                }
        } else {
                                ;
                }
        } else {
-               strncat(options, "user_xattr,acl", 14);
+               strncat(options, "user_xattr,acl", PAGE_SIZE);
        }
 
        /* Glom up mount options */
        if (*options != '\0')
        }
 
        /* Glom up mount options */
        if (*options != '\0')
-               strcat(options, ",");
-       strlcat(options, "no_mbcache,nodelalloc", PAGE_SIZE);
+               strncat(options, ",", PAGE_SIZE);
+       strncat(options, "no_mbcache,nodelalloc", PAGE_SIZE);
 
        type = get_fs_type("ldiskfs");
        if (!type) {
 
        type = get_fs_type("ldiskfs");
        if (!type) {
index 33e6570..72ce072 100644 (file)
@@ -89,7 +89,7 @@ static void nodemap_cluster_rec_init(union nodemap_rec *nr,
 {
        CLASSERT(sizeof(nr->ncr.ncr_name) == sizeof(nodemap->nm_name));
 
 {
        CLASSERT(sizeof(nr->ncr.ncr_name) == sizeof(nodemap->nm_name));
 
-       strncpy(nr->ncr.ncr_name, nodemap->nm_name, sizeof(nodemap->nm_name));
+       strncpy(nr->ncr.ncr_name, nodemap->nm_name, sizeof(nr->ncr.ncr_name));
        nr->ncr.ncr_squash_uid = cpu_to_le32(nodemap->nm_squash_uid);
        nr->ncr.ncr_squash_gid = cpu_to_le32(nodemap->nm_squash_gid);
        nr->ncr.ncr_flags = cpu_to_le32(
        nr->ncr.ncr_squash_uid = cpu_to_le32(nodemap->nm_squash_uid);
        nr->ncr.ncr_squash_gid = cpu_to_le32(nodemap->nm_squash_gid);
        nr->ncr.ncr_flags = cpu_to_le32(
index 6aaed49..f2c460a 100644 (file)
@@ -137,13 +137,13 @@ static int qsd_enabled_seq_show(struct seq_file *m, void *data)
 
        memset(enabled, 0, sizeof(enabled));
        if (qsd_type_enabled(qsd, USRQUOTA))
 
        memset(enabled, 0, sizeof(enabled));
        if (qsd_type_enabled(qsd, USRQUOTA))
-               strcat(enabled, "u");
+               strncat(enabled, "u", sizeof(enabled) - strlen(enabled));
        if (qsd_type_enabled(qsd, GRPQUOTA))
        if (qsd_type_enabled(qsd, GRPQUOTA))
-               strcat(enabled, "g");
+               strncat(enabled, "g", sizeof(enabled) - strlen(enabled));
        if (qsd_type_enabled(qsd, PRJQUOTA))
        if (qsd_type_enabled(qsd, PRJQUOTA))
-               strncat(enabled, "p", 1);
+               strncat(enabled, "p", sizeof(enabled) - strlen(enabled));
        if (strlen(enabled) == 0)
        if (strlen(enabled) == 0)
-               strcat(enabled, "none");
+               strncat(enabled, "none", sizeof(enabled) - strlen(enabled));
 
        seq_printf(m, "%s\n", enabled);
        return 0;
 
        seq_printf(m, "%s\n", enabled);
        return 0;