<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><span style="white-space: pre-wrap">
</span></p>
    <blockquote type="cite"
cite="mid:ac4867a4c6da6aef61b189960c0142a660b2122b.camel@nvidia.com">
      <pre wrap="" class="moz-quote-pre">Can you provide an example of how/when this would be the case?</pre>
    </blockquote>
    <p>The issue was discovered through static analysis after reviewing
      changes introduced<br>
      by commit 773eb04d14a1 ("drm/nouveau/disp: expose conn event
      class").<br>
      <br>
      Originally, nouveau_dp_irq() checked the result of find_encoder()
      before using it:<br>
      <br>
          struct nouveau_encoder *outp = find_encoder(connector,
      DCB_OUTPUT_DP);<br>
      <br>
          if (!outp)<br>
              return;<br>
      <br>
      Commit 773eb04d14a1 introduced the line:<br>
      <br>
          struct nouveau_drm *drm = nouveau_drm(outp->base.base.dev);<br>
      <br>
      before the existing if (!outp) guard. As a result, outp is now
      dereferenced<br>
      prior to the NULL check. The patch simply restores the correct
      ordering by moving<br>
      the initialization of drm after the outp validation.</p>
  </body>
</html>