From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: drm/vkms: Allow to hot-add connectors Date: Thu, 23 Apr 2026 07:30:19 +1000 Message-ID: In-Reply-To: <20260422-vkms-all-config-v4-34-dbb52e9aadc3@bootlin.com> References: <20260422-vkms-all-config-v4-0-dbb52e9aadc3@bootlin.com> <20260422-vkms-all-config-v4-34-dbb52e9aadc3@bootlin.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review **Bug: wrong error check after allocation.** In `vkms_connector_hot_add()`: ```c connector = kzalloc_obj(*connector, GFP_KERNEL); if (IS_ERR(connector)) return connector; ``` `kzalloc_obj` (a wrapper around `kzalloc`) returns **NULL** on failure, never `ERR_PTR`. `IS_ERR(NULL)` is false, so a failed allocation is not caught and the code proceeds to dereference NULL in `drm_connector_dynamic_init()`. Must be `if (!connector) return ERR_PTR(-ENOMEM);`. **Bug: resource leak on error paths after `drm_connector_dynamic_init()`.** The `__free(kfree)` cleanup attribute will call `kfree(connector)` when returning ERR_PTR, but after a successful `drm_connector_dynamic_init()`, the connector has internal DRM state that requires `drm_connector_cleanup()` before freeing. The error paths for `drm_connector_attach_encoder()`, `vkms_connector_init()`, etc. leak DRM connector resources. --- Generated by Claude Code Patch Reviewer