])
#
+# 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_PROG_CC
LB_CC_NO_FORMAT_TRUNCATION
+LB_CC_NO_STRINGOP_TRUNCATION
+LB_CC_NO_STRINGOP_OVERFLOW
LC_OSD_ADDON
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 +
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",
/* 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;
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);
"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]);
;
}
} else {
- strncat(options, "user_xattr,acl", 14);
+ strncat(options, "user_xattr,acl", PAGE_SIZE);
}
/* 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) {
{
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(
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))
- strcat(enabled, "g");
+ strncat(enabled, "g", sizeof(enabled) - strlen(enabled));
if (qsd_type_enabled(qsd, PRJQUOTA))
- strncat(enabled, "p", 1);
+ strncat(enabled, "p", sizeof(enabled) - strlen(enabled));
if (strlen(enabled) == 0)
- strcat(enabled, "none");
+ strncat(enabled, "none", sizeof(enabled) - strlen(enabled));
seq_printf(m, "%s\n", enabled);
return 0;