Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/125312/?format=api
http://patches.dpdk.org/api/patches/125312/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230320102624.1258816-1-david.marchand@redhat.com/", "project": { "id": 1, "url": "http://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20230320102624.1258816-1-david.marchand@redhat.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20230320102624.1258816-1-david.marchand@redhat.com", "date": "2023-03-20T10:26:22", "name": "[1/2] app/mldev: fix build with debug", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "3927ea559b1695ada1aa2beffa1de2c04103db38", "submitter": { "id": 1173, "url": "http://patches.dpdk.org/api/people/1173/?format=api", "name": "David Marchand", "email": "david.marchand@redhat.com" }, "delegate": { "id": 1, "url": "http://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20230320102624.1258816-1-david.marchand@redhat.com/mbox/", "series": [ { "id": 27461, "url": "http://patches.dpdk.org/api/series/27461/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=27461", "date": "2023-03-20T10:26:22", "name": "[1/2] app/mldev: fix build with debug", "version": 1, "mbox": "http://patches.dpdk.org/series/27461/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/125312/comments/", "check": "warning", "checks": "http://patches.dpdk.org/api/patches/125312/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 9E326427E0;\n\tMon, 20 Mar 2023 11:26:40 +0100 (CET)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 838B440A7F;\n\tMon, 20 Mar 2023 11:26:40 +0100 (CET)", "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by mails.dpdk.org (Postfix) with ESMTP id 8074D406BC\n for <dev@dpdk.org>; Mon, 20 Mar 2023 11:26:38 +0100 (CET)", "from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com\n [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n us-mta-606-2ephxe8ZMFqAIRaqrFtH0g-1; Mon, 20 Mar 2023 06:26:34 -0400", "from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com\n [10.11.54.4])\n (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n (No client certificate requested)\n by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7F9D2101A54F;\n Mon, 20 Mar 2023 10:26:34 +0000 (UTC)", "from dmarchan.redhat.com (unknown [10.45.224.63])\n by smtp.corp.redhat.com (Postfix) with ESMTP id C16D82027047;\n Mon, 20 Mar 2023 10:26:33 +0000 (UTC)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1679307998;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=W9QNH0H2eQGuMNHClXtT+wSmUnuFmkxT0WOjR92OzmM=;\n b=L5p0skZeyr3ZhT7L803yp9+jokG0MWoPRJwvYiEgRKHWyFewzfqBBy6WvbHzLpEy0kswcm\n BFbBXaA9f16Rq6QqauEMKei6PgpgxLP21aJLCMYHsCCzOQW8iFySbxfyMaa+Sk3K8V/Spj\n /FWXfgdFJuoV92qbgloT2TZKbNJfxX4=", "X-MC-Unique": "2ephxe8ZMFqAIRaqrFtH0g-1", "From": "David Marchand <david.marchand@redhat.com>", "To": "dev@dpdk.org", "Cc": "Srikanth Yalavarthi <syalavarthi@marvell.com>,\n Anup Prabhu <aprabhu@marvell.com>", "Subject": "[PATCH 1/2] app/mldev: fix build with debug", "Date": "Mon, 20 Mar 2023 11:26:22 +0100", "Message-Id": "<20230320102624.1258816-1-david.marchand@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 3.1 on 10.11.54.4", "X-Mimecast-Spam-Score": "0", "X-Mimecast-Originator": "redhat.com", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org" }, "content": "Compiling with -O0 and -g triggers these warnings:\n\n../app/test-mldev/test_inference_common.c: In function\n\t‘ml_request_finish’:\n../app/test-mldev/test_inference_common.c:946:51:\n\terror: ‘.q.’ directive output may be truncated writing 3 bytes\n\tinto a region of size between 0 and 4095\n\t[-Werror=format-truncation=]\n 946 | snprintf(str, sizeof(str) - 1, \"%s.q.%d\",\n | ^~~\n\tt->cmn.opt->filelist[req->fid].output, obj_idx);\n../app/test-mldev/test_inference_common.c:946:48: note: using the range\n\t[-2147483648, 2147483647] for directive argument\n 946 | snprintf(str, sizeof(str) - 1, \"%s.q.%d\",\n | ^~~~~~~~~\n\tt->cmn.opt->filelist[req->fid].output, obj_idx);\n../app/test-mldev/test_inference_common.c:946:17: note: ‘snprintf’\n\toutput between 5 and 4110 bytes into a destination of size 4095\n 946 | snprintf(str, sizeof(str) - 1, \"%s.q.%d\",\n | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\tt->cmn.opt->filelist[req->fid].output, obj_idx);\n../app/test-mldev/test_inference_common.c:952:51: error: ‘.’ directive\n\toutput may be truncated writing 1 byte into a region of size\n\tbetween 0 and 4095 [-Werror=format-truncation=]\n 952 | snprintf(str, sizeof(str) - 1, \"%s.%d\",\n | ^\n\tt->cmn.opt->filelist[req->fid].output, obj_idx);\n../app/test-mldev/test_inference_common.c:952:48: note: using the range\n\t[-2147483648, 2147483647] for directive argument\n 952 | snprintf(str, sizeof(str) - 1, \"%s.%d\",\n | ^~~~~~~\n\tt->cmn.opt->filelist[req->fid].output, obj_idx);\n../app/test-mldev/test_inference_common.c:952:17: note: ‘snprintf’\n\toutput between 3 and 4108 bytes into a destination of size 4095\n 952 | snprintf(str, sizeof(str) - 1, \"%s.%d\",\n | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\tt->cmn.opt->filelist[req->fid].output, obj_idx);\n../app/test-mldev/test_inference_common.c:929:51: error: ‘.q’ directive\n\toutput may be truncated writing 2 bytes into a region of size\n\tbetween 0 and 4095 [-Werror=format-truncation=]\n 929 | snprintf(str, sizeof(str) - 1, \"%s.q\",\n | ^~\n\tt->cmn.opt->filelist[req->fid].output);\n../app/test-mldev/test_inference_common.c:929:17: note: ‘snprintf’\n\toutput between 3 and 4098 bytes into a destination of size 4095\n 929 | snprintf(str, sizeof(str) - 1, \"%s.q\",\n | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\tt->cmn.opt->filelist[req->fid].output);\n../app/test-mldev/test_inference_common.c:935:51: error: ‘snprintf’\n\toutput may be truncated before the last format character\n\t[-Werror=format-truncation=]\n 935 | snprintf(str, sizeof(str) - 1, \"%s\",\n | ^\n\tt->cmn.opt->filelist[req->fid].output);\n../app/test-mldev/test_inference_common.c:935:17: note: ‘snprintf’\n\toutput between 1 and 4096 bytes into a destination of size 4095\n 935 | snprintf(str, sizeof(str) - 1, \"%s\",\n | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\tt->cmn.opt->filelist[req->fid].output);\n\nFix unsigned integer format, and switch to dynamic allocations.\n\nFixes: da6793390596 (\"app/mldev: support inference validation\")\n\nSigned-off-by: David Marchand <david.marchand@redhat.com>\n---\n app/test-mldev/test_inference_common.c | 29 ++++++++++++++++++--------\n 1 file changed, 20 insertions(+), 9 deletions(-)", "diff": "diff --git a/app/test-mldev/test_inference_common.c b/app/test-mldev/test_inference_common.c\nindex e85f32be60..f7ce732d9a 100644\n--- a/app/test-mldev/test_inference_common.c\n+++ b/app/test-mldev/test_inference_common.c\n@@ -3,6 +3,7 @@\n */\n \n #include <errno.h>\n+#include <stdio.h>\n #include <unistd.h>\n \n #include <rte_common.h>\n@@ -901,8 +902,8 @@ ml_request_finish(struct rte_mempool *mp, void *opaque, void *obj, unsigned int\n \tstruct test_inference *t = ml_test_priv((struct ml_test *)opaque);\n \tstruct ml_request *req = (struct ml_request *)obj;\n \tstruct ml_model *model = &t->model[req->fid];\n-\tchar str[PATH_MAX];\n \tbool error = false;\n+\tchar *dump_path;\n \n \tRTE_SET_USED(mp);\n \n@@ -926,14 +927,18 @@ ml_request_finish(struct rte_mempool *mp, void *opaque, void *obj, unsigned int\n dump_output_pass:\n \tif (obj_idx == 0) {\n \t\t/* write quantized output */\n-\t\tsnprintf(str, PATH_MAX, \"%s.q\", t->cmn.opt->filelist[req->fid].output);\n-\t\tML_OPEN_WRITE_GET_ERR(str, req->output, model->out_qsize, error);\n+\t\tif (asprintf(&dump_path, \"%s.q\", t->cmn.opt->filelist[req->fid].output) == -1)\n+\t\t\treturn;\n+\t\tML_OPEN_WRITE_GET_ERR(dump_path, req->output, model->out_qsize, error);\n+\t\tfree(dump_path);\n \t\tif (error)\n \t\t\treturn;\n \n \t\t/* write dequantized output */\n-\t\tsnprintf(str, PATH_MAX, \"%s\", t->cmn.opt->filelist[req->fid].output);\n-\t\tML_OPEN_WRITE_GET_ERR(str, model->output, model->out_dsize, error);\n+\t\tif (asprintf(&dump_path, \"%s\", t->cmn.opt->filelist[req->fid].output) == -1)\n+\t\t\treturn;\n+\t\tML_OPEN_WRITE_GET_ERR(dump_path, model->output, model->out_dsize, error);\n+\t\tfree(dump_path);\n \t\tif (error)\n \t\t\treturn;\n \t}\n@@ -943,14 +948,20 @@ ml_request_finish(struct rte_mempool *mp, void *opaque, void *obj, unsigned int\n dump_output_fail:\n \tif (t->cmn.opt->debug) {\n \t\t/* dump quantized output buffer */\n-\t\tsnprintf(str, PATH_MAX, \"%s.q.%d\", t->cmn.opt->filelist[req->fid].output, obj_idx);\n-\t\tML_OPEN_WRITE_GET_ERR(str, req->output, model->out_qsize, error);\n+\t\tif (asprintf(&dump_path, \"%s.q.%d\", t->cmn.opt->filelist[req->fid].output,\n+\t\t\t\tobj_idx) == -1)\n+\t\t\treturn;\n+\t\tML_OPEN_WRITE_GET_ERR(dump_path, req->output, model->out_qsize, error);\n+\t\tfree(dump_path);\n \t\tif (error)\n \t\t\treturn;\n \n \t\t/* dump dequantized output buffer */\n-\t\tsnprintf(str, PATH_MAX, \"%s.%d\", t->cmn.opt->filelist[req->fid].output, obj_idx);\n-\t\tML_OPEN_WRITE_GET_ERR(str, model->output, model->out_dsize, error);\n+\t\tif (asprintf(&dump_path, \"%s.%d\", t->cmn.opt->filelist[req->fid].output,\n+\t\t\t\tobj_idx) == -1)\n+\t\t\treturn;\n+\t\tML_OPEN_WRITE_GET_ERR(dump_path, model->output, model->out_dsize, error);\n+\t\tfree(dump_path);\n \t\tif (error)\n \t\t\treturn;\n \t}\n", "prefixes": [ "1/2" ] }{ "id": 125312, "url": "