check_format: add [v]sprintf() to banned functions

Fix up the single instance in the tree (dmaperf.c example) and
disallow more string functions with no destination buffer size.

Change-Id: I2bd39d6e848cd8a13536e26c4f0ee6713cf6dff9
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/406829
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Daniel Verkamp 2018-04-06 11:45:19 -07:00 committed by Jim Harris
parent 85199c8937
commit f40c3e9825
2 changed files with 2 additions and 2 deletions

View File

@ -605,7 +605,7 @@ static int perf_debugfs_setup(struct perf_ctx *perf)
for (i = 0; i < MAX_THREADS; i++) { for (i = 0; i < MAX_THREADS; i++) {
struct pthr_ctx *pctx = &perf->pthr_ctx[i]; struct pthr_ctx *pctx = &perf->pthr_ctx[i];
sprintf(temp_name, "thread_%d", i); snprintf(temp_name, sizeof(temp_name), "thread_%d", i);
pctx->debugfs_thr_dir = debugfs_create_dir(temp_name, perf->debugfs_node_dir); pctx->debugfs_thr_dir = debugfs_create_dir(temp_name, perf->debugfs_node_dir);
if (!pctx->debugfs_thr_dir) { if (!pctx->debugfs_thr_dir) {

View File

@ -77,7 +77,7 @@ rm -f whitespace.log
echo -n "Checking for use of forbidden library functions..." echo -n "Checking for use of forbidden library functions..."
git grep -w strcpy -- app examples lib test > badfunc.log || true git grep -w '\(strcpy\|sprintf\|vsprintf\)' -- app examples lib test > badfunc.log || true
if [ -s badfunc.log ]; then if [ -s badfunc.log ]; then
echo " Forbidden library functions detected" echo " Forbidden library functions detected"