<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/61185>61185</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Clang Tidy's bugprone-misplaced-widening-cast complains about provably safe expressions
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          ryao
      </td>
    </tr>
</table>

<pre>
    Clang Tidy complains about this:

https://github.com/openzfs/zfs/blob/620a977f22a656d4d0da395c4d8cc661e4b4ba8a/module/zstd/lib/compress/zstd_compress_superblock.c#L372

Here, we know that the result will be at most 5, no matter what happens. The complaint about a misplaced widening cast is a false positive.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8ks-OnDAMxp8mXKxBIeHPcODQ7gr10OPeVw7xQLqBoDjMdPr0FXR2u-qhF0dxHOv77B8yu3Eh6kT1VVTPGW5pCrGLdwyZCfbePXlcRnhx9g5DmFePbmFAE7YEaXIs9Bchn4V8xCml9cipXqh-dGnaTD6EWag-rLT8urBQ_Z9ofDBC9bWS2DbNRSmsq9qWVlrUbTWU9jwMdV1QaUqDZxSqn4PdPO0NOFmheu_2BruqSMyP_Ov7_ZW3laLxYXjLB6H0d92oz1K_USShnuBG8LaEG6QJd0sEkXjzCW7OezAEmGAOnKDai5cAM6ZEEW57-YTrSgvn8DLRx3jSYzwIs-PV40AWbs7S4pYRBuQEjgHhgp4J1sAuuSvlme20bXWLGXVF3TRtq4u2zqZOG91qWcqyKGxly6E9k9WmkdZUZdmWMnOdkkpLLStZFbqo8wupoTKFqc6tvsiyEaWkGZ3Pvb_OeYhj5pg36uqiOFeZR0Oej_0rtdANjkeh1I5D7PY_J7ONLErpHSf-2yW55OkTIEI1DGYb1xgWOn2YP72bPx3m_6VojeGKxt-B8UJAP4_lubBwtkXf_QeoXcfjOK0x_KAhCdUf6ncYDne_AwAA__84MvHg">