<html>
<head>
<base href="https://bugs.dpdk.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8" class="bz_new_table">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_UNCONFIRMED "
title="UNCONFIRMED - sched: potential issue with memcmp of padding"
href="https://bugs.dpdk.org/show_bug.cgi?id=1588">1588</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>sched: potential issue with memcmp of padding
</td>
</tr>
<tr>
<th>Product</th>
<td>DPDK
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>UNCONFIRMED
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>Normal
</td>
</tr>
<tr>
<th>Component</th>
<td>other
</td>
</tr>
<tr>
<th>Assignee</th>
<td>dev@dpdk.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>stephen@networkplumber.org
</td>
</tr>
<tr>
<th>Target Milestone</th>
<td>---
</td>
</tr></table>
<p>
<div class="bz_comment_block">
<pre class="bz_comment_text">The tool PVS-studio flagged this code as a potential bug because of using
memcmp on a padded structure.
int
rte_sched_subport_pipe_profile_add(struct rte_sched_port *port,
uint32_t subport_id,
struct rte_sched_pipe_params *params,
uint32_t *pipe_profile_id)
{
...
/* Pipe profile should not exists */
for (i = 0; i < s->n_pipe_profiles; i++)
if (memcmp(s->pipe_profiles + i, pp, sizeof(*pp)) == 0) {
The layout of the structure reported by pahole is:
struct rte_sched_pipe_profile {
uint64_t tb_period; /* 0 8 */
uint64_t tb_credits_per_period; /* 8 8 */
uint64_t tb_size; /* 16 8 */
uint64_t tc_period; /* 24 8 */
uint64_t tc_credits_per_period[13]; /* 32 104 */
/* --- cacheline 2 boundary (128 bytes) was 8 bytes ago --- */
uint8_t tc_ov_weight; /* 136 1 */
uint8_t wrr_cost[4]; /* 137 4 */
/* size: 144, cachelines: 3, members: 7 */
/* padding: 3 */
/* last cacheline: 16 bytes */
};
So the compiler will generate code comparing the last 3 bytes which is bad.
</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
<link itemprop="url" href="https://bugs.dpdk.org/show_bug.cgi?id=1588">
<meta itemprop="name" content="View bug">
</div>
<meta itemprop="description" content="Bugzilla bug update notification">
</div>
</body>
</html>