Hello Oleg Drokin,
The patch 76133e66b141: "staging/lustre: Replace jobid acquiring with
per node setting" from Apr 27, 2014, leads to the following static
checker warning:
drivers/staging/lustre/lustre/obdclass/class_obd.c:131
lustre_get_jobid()
error: strcpy() 'obd_jobid_node' too large for 'jobid' (33 vs 32)
drivers/staging/lustre/lustre/obdclass/class_obd.c
105 char obd_jobid_node[JOBSTATS_JOBID_SIZE + 1];
106
107 /* Get jobid of current process from stored variable or calculate
108 * it from pid and user_id.
109 *
110 * Historically this was also done by reading the environment variable
111 * stored in between the "env_start" & "env_end" of task struct.
112 * This is now deprecated.
113 */
114 int lustre_get_jobid(char *jobid)
115 {
116 memset(jobid, 0, JOBSTATS_JOBID_SIZE);
117 /* Jobstats isn't enabled */
118 if (strcmp(obd_jobid_var, JOBSTATS_DISABLE) == 0)
119 return 0;
120
121 /* Use process name + fsuid as jobid */
122 if (strcmp(obd_jobid_var, JOBSTATS_PROCNAME_UID) == 0) {
123 snprintf(jobid, JOBSTATS_JOBID_SIZE, "%s.%u",
124 current_comm(),
125 from_kuid(&init_user_ns, current_fsuid()));
126 return 0;
127 }
128
129 /* Whole node dedicated to single job */
130 if (strcmp(obd_jobid_var, JOBSTATS_NODELOCAL) == 0) {
131 strcpy(jobid, obd_jobid_node);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jobid is JOBSTATS_JOBID_SIZE 32 characters but obd_jobid_node is
33 characters.
132 return 0;
133 }
134
135 return -ENOENT;
136 }
regards,
dan carpenter
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel