drivers/gpu/drm/drm_atomic_uapi.c:342:23-26: ERROR: crtc is NULL but dereferenced. (fwd)
PATCH 986/990 drivers/gpu/drm/drm_atomic_uapi.c:342:23-26: ERROR: crtc is NULL but dereferenced. (fwd)
Hello,
The dereference on line 342 does not look correct.
julia
---------- Forwarded message ----------
Date: Sun, 15 Nov 2020 10:58:55 +0800
From: kernel test robot <[email protected]>
To: kbuild(a)lists.01.org
Cc: lkp(a)intel.com, Julia Lawall <[email protected]>,
Elena Reshetova <[email protected]>
Subject: [drm-drm-misc:for-linux-next 986/990]
drivers/gpu/drm/drm_atomic_uapi.c:342:23-26: ERROR: crtc is NULL but
dereferenced.CC: kbuild-all(a)lists.01.org
TO: Simon Ser <[email protected]>
CC: Sam Ravnborg <[email protected]>
CC: Daniel Vetter <[email protected]>
tree: git://anongit.freedesktop.org/drm/drm-misc for-linux-next head: 5933baa36e267e480bec59a752579c7581b0b2f5 commit: e3aae683e861a987d3d7dca593aaff93ac001bcb [986/990] drm: convert drm_atomic_uapi.c to new debug helpers
:::::: branch date: 7 hours ago
:::::: commit date: 13 hours ago
config: microblaze-randconfig-c004-20201115 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
"coccinelle warnings: (new ones prefixed by >>)"
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/drm_atomic_uapi.c:342:23-26: ERROR: crtc is NULL but dereferenced.
vim +342 drivers/gpu/drm/drm_atomic_uapi.c
72fdb40c1a4b48f Daniel Vetter 2018-09-05 290
72fdb40c1a4b48f Daniel Vetter 2018-09-05 291 /**
42240c90e3b03de Thierry Reding 2019-12-06 292 * drm_atomic_set_crtc_for_connector - set CRTC for connector
72fdb40c1a4b48f Daniel Vetter 2018-09-05 293 * @conn_state: atomic state object for the connector
42240c90e3b03de Thierry Reding 2019-12-06 294 * @crtc: CRTC to use for the connector
72fdb40c1a4b48f Daniel Vetter 2018-09-05 295 *
42240c90e3b03de Thierry Reding 2019-12-06 296 * Changing the assigned CRTC for a connector requires us to grab the lock and
42240c90e3b03de Thierry Reding 2019-12-06 297 * state for the new CRTC, as needed. This function takes care of all these
72fdb40c1a4b48f Daniel Vetter 2018-09-05 298 * details besides updating the pointer in the state object itself.
72fdb40c1a4b48f Daniel Vetter 2018-09-05 299 *
72fdb40c1a4b48f Daniel Vetter 2018-09-05 300 * Returns:
72fdb40c1a4b48f Daniel Vetter 2018-09-05 301 * 0 on success or can fail with -EDEADLK or -ENOMEM. When the error is EDEADLK
72fdb40c1a4b48f Daniel Vetter 2018-09-05 302 * then the w/w mutex code has detected a deadlock and the entire atomic
72fdb40c1a4b48f Daniel Vetter 2018-09-05 303 * sequence must be restarted. All other errors are fatal.
72fdb40c1a4b48f Daniel Vetter 2018-09-05 304 */
72fdb40c1a4b48f Daniel Vetter 2018-09-05 305 int
72fdb40c1a4b48f Daniel Vetter 2018-09-05 306 drm_atomic_set_crtc_for_connector(struct drm_connector_state *conn_state,
72fdb40c1a4b48f Daniel Vetter 2018-09-05 307 struct drm_crtc *crtc)
72fdb40c1a4b48f Daniel Vetter 2018-09-05 308 {
72fdb40c1a4b48f Daniel Vetter 2018-09-05 309 struct drm_connector *connector = conn_state->connector;
72fdb40c1a4b48f Daniel Vetter 2018-09-05 310 struct drm_crtc_state *crtc_state;
72fdb40c1a4b48f Daniel Vetter 2018-09-05 311
72fdb40c1a4b48f Daniel Vetter 2018-09-05 312 if (conn_state->crtc == crtc)
72fdb40c1a4b48f Daniel Vetter 2018-09-05 313 return 0;
72fdb40c1a4b48f Daniel Vetter 2018-09-05 314
72fdb40c1a4b48f Daniel Vetter 2018-09-05 315 if (conn_state->crtc) {
72fdb40c1a4b48f Daniel Vetter 2018-09-05 316 crtc_state = drm_atomic_get_new_crtc_state(conn_state->state,
72fdb40c1a4b48f Daniel Vetter 2018-09-05 317 conn_state->crtc);
72fdb40c1a4b48f Daniel Vetter 2018-09-05 318
72fdb40c1a4b48f Daniel Vetter 2018-09-05 319 crtc_state->connector_mask &=
72fdb40c1a4b48f Daniel Vetter 2018-09-05 320 ~drm_connector_mask(conn_state->connector);
72fdb40c1a4b48f Daniel Vetter 2018-09-05 321
72fdb40c1a4b48f Daniel Vetter 2018-09-05 322 drm_connector_put(conn_state->connector);
72fdb40c1a4b48f Daniel Vetter 2018-09-05 323 conn_state->crtc = NULL;
72fdb40c1a4b48f Daniel Vetter 2018-09-05 324 }
72fdb40c1a4b48f Daniel Vetter 2018-09-05 325
72fdb40c1a4b48f Daniel Vetter 2018-09-05 326 if (crtc) {
72fdb40c1a4b48f Daniel Vetter 2018-09-05 327 crtc_state = drm_atomic_get_crtc_state(conn_state->state, crtc);
72fdb40c1a4b48f Daniel Vetter 2018-09-05 328 if (IS_ERR(crtc_state))
72fdb40c1a4b48f Daniel Vetter 2018-09-05 329 return PTR_ERR(crtc_state);
72fdb40c1a4b48f Daniel Vetter 2018-09-05 330
72fdb40c1a4b48f Daniel Vetter 2018-09-05 331 crtc_state->connector_mask |=
72fdb40c1a4b48f Daniel Vetter 2018-09-05 332 drm_connector_mask(conn_state->connector);
72fdb40c1a4b48f Daniel Vetter 2018-09-05 333
72fdb40c1a4b48f Daniel Vetter 2018-09-05 334 drm_connector_get(conn_state->connector);
72fdb40c1a4b48f Daniel Vetter 2018-09-05 335 conn_state->crtc = crtc;
72fdb40c1a4b48f Daniel Vetter 2018-09-05 336
e3aae683e861a98 Simon Ser 2020-11-11 337 drm_dbg_atomic(crtc->dev,
e3aae683e861a98 Simon Ser 2020-11-11 338 "Link [CONNECTOR:%d:%s] state %p to [CRTC:%d:%s]\n",
72fdb40c1a4b48f Daniel Vetter 2018-09-05 339 connector->base.id, connector->name,
72fdb40c1a4b48f Daniel Vetter 2018-09-05 340 conn_state, crtc->base.id, crtc->name);
72fdb40c1a4b48f Daniel Vetter 2018-09-05 341 } else {
e3aae683e861a98 Simon Ser 2020-11-11 @342 drm_dbg_atomic(crtc->dev,
e3aae683e861a98 Simon Ser 2020-11-11 343 "Link [CONNECTOR:%d:%s] state %p to [NOCRTC]\n",
72fdb40c1a4b48f Daniel Vetter 2018-09-05 344 connector->base.id, connector->name,
72fdb40c1a4b48f Daniel Vetter 2018-09-05 345 conn_state);
72fdb40c1a4b48f Daniel Vetter 2018-09-05 346 }
72fdb40c1a4b48f Daniel Vetter 2018-09-05 347
72fdb40c1a4b48f Daniel Vetter 2018-09-05 348 return 0;
72fdb40c1a4b48f Daniel Vetter 2018-09-05 349 }
72fdb40c1a4b48f Daniel Vetter 2018-09-05 350 EXPORT_SYMBOL(drm_atomic_set_crtc_for_connector);
72fdb40c1a4b48f Daniel Vetter 2018-09-05 351---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Quoted 1 line · Julia Lawall
The dereference on line 342 does not look correct.
Indeed. See:
https://lists.freedesktop.org/archives/dri-devel/2020-November/287180.html