<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 - lpm: undefined right shift"
   href="https://bugs.dpdk.org/show_bug.cgi?id=1587">1587</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>lpm: undefined right shift
          </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">Both rte_lpm.c and rte_lpm6.c are using >> operator on a negative integer.
According to the C standard the result of that is implementation defined (ie
not portable).

Reported by PVS studio as warning:
<a href="https://pvs-studio.com/en/docs/warnings/v610/">https://pvs-studio.com/en/docs/warnings/v610/</a>

static uint32_t __rte_pure
depth_to_mask(uint8_t depth)
{
        VERIFY_DEPTH(depth);

        /* To calculate a mask start with a 1 on the left hand side and right
         * shift while populating the left hand side with 1's
         */
        return (int)0x80000000 >> (depth - 1);
}

and

static uint8_t __rte_pure
depth_to_mask_1b(uint8_t depth)
{
        /* To calculate a mask start with a 1 on the left hand side and right
         * shift while populating the left hand side with 1's
         */
        return (signed char)0x80 >> (depth - 1);
}
          </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=1587">
          <meta itemprop="name" content="View bug">
        </div>
        <meta itemprop="description" content="Bugzilla bug update notification">
      </div>
    </body>
</html>