summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
b9bdd84)
Starting with gcc version 7 several platforms have enabled new
flags to report potential problems when compling code. For lustre
much of the reported problems deal with potential buffer overruns.
Also we have unused data structures and are not properly
initializing some data structures.
Change-Id: I10243ea88f2c726032d179febdbf26f28de13715
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/30376
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
int col = col_start;
int char_max;
int len;
int col = col_start;
int char_max;
int len;
/* Add trailing spaces to pad the entry to the column size */
if (len < char_max) {
/* Add trailing spaces to pad the entry to the column size */
if (len < char_max) {
- snprintf(fmt, 6, "%%-%2ds", char_max - len);
snprintf(&buffer[col * char_max] + len,
snprintf(&buffer[col * char_max] + len,
- char_max - len + 1, fmt, " ");
+ char_max - len + 1, "%*s", char_max - len,
+ " ");
} else {
buffer[(col + 1) * char_max - 1] = ' ';
}
} else {
buffer[(col + 1) * char_max - 1] = ' ';
}
.mode = 0644,
.proc_handler = &proc_lnet_portal_rotor,
},
.mode = 0644,
.proc_handler = &proc_lnet_portal_rotor,
},
};
void lnet_router_debugfs_init(void)
};
void lnet_router_debugfs_init(void)
struct dt_device *lsi_dt_dev; /* dt device to access disk fs*/
atomic_t lsi_mounts; /* references to the srv_mnt */
char lsi_svname[MTI_NAME_MAXLEN];
struct dt_device *lsi_dt_dev; /* dt device to access disk fs*/
atomic_t lsi_mounts; /* references to the srv_mnt */
char lsi_svname[MTI_NAME_MAXLEN];
- char lsi_osd_obdname[64];
- char lsi_osd_uuid[64];
+ /* lsi_osd_obdname format = 'lsi->ls_svname'-osd */
+ char lsi_osd_obdname[MTI_NAME_MAXLEN + 4];
+ /* lsi_osd_uuid format = 'lsi->ls_osd_obdname'_UUID */
+ char lsi_osd_uuid[MTI_NAME_MAXLEN + 9];
struct obd_export *lsi_osd_exp;
char lsi_osd_type[16];
char lsi_fstype[16];
struct obd_export *lsi_osd_exp;
char lsi_osd_type[16];
char lsi_fstype[16];
data->ioc_inllen3 == sizeof(__u64) &&
data->ioc_inlbuf4 != NULL &&
data->ioc_inllen4 == sizeof(__u64)) {
data->ioc_inllen3 == sizeof(__u64) &&
data->ioc_inlbuf4 != NULL &&
data->ioc_inllen4 == sizeof(__u64)) {
+ struct ost_id ostid = { };
ostid_set_seq(&ostid, *(__u64 *)data->ioc_inlbuf4);
rc = ostid_set_id(&ostid, *(__u64 *)data->ioc_inlbuf3);
ostid_set_seq(&ostid, *(__u64 *)data->ioc_inlbuf4);
rc = ostid_set_id(&ostid, *(__u64 *)data->ioc_inlbuf3);
struct osd_oi **oi_table, unsigned oi_count, bool create)
{
struct scrub_file *sf = &osd->od_scrub.os_scrub.os_file;
struct osd_oi **oi_table, unsigned oi_count, bool create)
{
struct scrub_file *sf = &osd->od_scrub.os_scrub.os_file;
- int count = 0;
- int rc = 0;
- int i;
+ int count = 0;
+ int rc = 0;
+ int i;
ENTRY;
/* NB: oi_count != 0 means that we have already created/known all OIs
ENTRY;
/* NB: oi_count != 0 means that we have already created/known all OIs
LASSERT(oi_count <= OSD_OI_FID_NR_MAX);
for (i = 0; i < (oi_count != 0 ? oi_count : OSD_OI_FID_NR_MAX); i++) {
LASSERT(oi_count <= OSD_OI_FID_NR_MAX);
for (i = 0; i < (oi_count != 0 ? oi_count : OSD_OI_FID_NR_MAX); i++) {
+ char name[sizeof(OSD_OI_NAME_BASE) + 3 * sizeof(i) + 1];
if (oi_table[i] != NULL) {
count++;
continue;
}
if (oi_table[i] != NULL) {
count++;
continue;
}
- sprintf(name, "%s.%d", OSD_OI_NAME_BASE, i);
+ snprintf(name, sizeof(name), "%s.%d", OSD_OI_NAME_BASE, i);
rc = osd_oi_open(info, osd, name, &oi_table[i], create);
if (rc == 0) {
count++;
rc = osd_oi_open(info, osd, name, &oi_table[i], create);
if (rc == 0) {
count++;
static const char *const lock_mode_names[] = LOCK_MODE_NAMES;
static const char *const lock_mode_names[] = LOCK_MODE_NAMES;
-static const char *const lockahead_results[] = {
- [LLA_RESULT_SENT] = "Lock request sent",
- [LLA_RESULT_DIFFERENT] = "Different matching lock found",
- [LLA_RESULT_SAME] = "Matching lock on identical extent found",
-};
-
int lfs_get_mode(const char *string)
{
enum lock_mode_user mode;
int lfs_get_mode(const char *string)
{
enum lock_mode_user mode;
return rc;
srandom(tv.tv_usec);
return rc;
srandom(tv.tv_usec);
- snprintf(new_fsname, 8, "%08x", (__u32)random());
- new_fsname[8] = '\0';
+ snprintf(new_fsname, sizeof(new_fsname), "%08x", (__u32)random());
rc = snapshot_get_mgsnode(si, buf, sizeof(buf));
if (rc)
rc = snapshot_get_mgsnode(si, buf, sizeof(buf));
if (rc)