<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
Hi Dan,<br>
<br>
drm-misc-fixes doesn't have the updated ttm_bo.c file, we have the
updated ttm_bo.c version in<br>
drm-misc-next branch. Please find below for the line number 907.<br>
<br>
<div class="moz-cite-prefix">On 8/11/2022 3:25 PM, Dan Carpenter
wrote:<br>
</div>
<blockquote type="cite" cite="mid:YvTSD44z0csJ8YsP@kili">
<pre class="moz-quote-pre" wrap="">Hello Arunpravin Paneer Selvam,
This is a semi-automatic email about new static checker warnings.
The patch cf4b7387c0a8: "drm/ttm: Fix dummy res NULL ptr deref bug"
from Aug 9, 2022, leads to the following Smatch complaint:
drivers/gpu/drm/ttm/ttm_bo.c:915 ttm_bo_validate()
warn: variable dereferenced before check 'bo->resource' (see line 907)
drivers/gpu/drm/ttm/ttm_bo.c
906 */
907 if (!ttm_resource_compat(bo->resource, placement)) {
^^^^^^^^^^^^
Unchecked dereference here inside the function.</pre>
</blockquote>
<br>
<pre style="padding: 0px; margin: 0px; color: rgb(0, 0, 0); font-size: 13.3333px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><code>if (!bo->resource || !ttm_resource_compat(bo->resource, placement)) {
we have this version in drm-misc-next
Regards,
Arun
</code></pre>
<blockquote type="cite" cite="mid:YvTSD44z0csJ8YsP@kili">
<pre class="moz-quote-pre" wrap="">
908 ret = ttm_bo_move_buffer(bo, placement, ctx);
909 if (ret)
910 return ret;
911 }
912 /*
913 * We might need to add a TTM.
914 */
915 if (!bo->resource || bo->resource->mem_type == TTM_PL_SYSTEM) {
^^^^^^^^^^^^
Checked too late.
This NULL check was added deliberately based on a report from the kbuild
bot, but it's not clear why bo->resource is NULL at this point. Was the
patch tested? There is a <a class="moz-txt-link-abbreviated" href="mailto:stable@vger.kernel.org">stable@vger.kernel.org</a> but there is no Fixes
tag.
916 ret = ttm_tt_create(bo, true);
917 if (ret)
regards,
dan carpenter
</pre>
</blockquote>
<br>
</body>
</html>