From patchwork Sat Mar 28 16:23:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11463633 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4BE16161F for ; Sat, 28 Mar 2020 16:24:12 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2AB702074F for ; Sat, 28 Mar 2020 16:24:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="C3ccucXr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2AB702074F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D9E096E126; Sat, 28 Mar 2020 16:24:07 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7A53A6E126 for ; Sat, 28 Mar 2020 16:24:06 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id h9so15447622wrc.8 for ; Sat, 28 Mar 2020 09:24:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pL8uWfiJYF1YmqwTh3ivt6YoZqoi/X1HSEs84exYYpg=; b=C3ccucXrAI/AxJWgheTxIMOhmAwC36qnObynEJ2ZE4TK1TCXUcikL1JOTxn0vhSp4z y6GmYp1Cm8p3NYxetLVJYCHtzXFdTx377T5zVrpR5GKfizqinVtAm9vmmMcJUIdkSA6E vJmZB61x1NL/QuF78X5IVcJDiDcQYoxNCn0OU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pL8uWfiJYF1YmqwTh3ivt6YoZqoi/X1HSEs84exYYpg=; b=MyC2DNBrwhJSrBiC+CGdxWGmmYYk+MqNHhi/0lyZl2HnAKZmVtBw3MqzfdaOHoC4Tx xToVPoIQo75IKeEQejtOmJmn/uxYX1KsGblUFCq5wcA0kppAa22sEf2VibaZECM73Q6A tDdnO0LqwUBHndsYJGN7XUa1q7Z2BD7xKnP/oNRAg2V64LuQhNlhrTA9w4FwT2QccP2o TIvOemNaTDkFkPdYkNZaX+INOEnKE03k1kjgAHqQQXXCIyNRx/F8OzOrTpQTcTwfUZuX 3cWzeRy4mzKM2+vpOu0SrTfA3nPXPodY0J7+0awaIxCKsRO8kxAYEIfRl1bcIeN8sMfk Nm+A== X-Gm-Message-State: ANhLgQ0Ib6dUrCsKYlBp+6F6jDRKHaPislxcp9F3XsoZBXREfGeMf6R9 Co2NhdB/NDDJIeXJv+KyHC70aS/Z0p/Bpg== X-Google-Smtp-Source: ADFU+vsHV/onbw1iAE7Qii36fICcu6vwX3zZkPy1MbkVDum1GX8N0+Z0ENoT+fd7fp20e1GRJPcmoQ== X-Received: by 2002:adf:f8ce:: with SMTP id f14mr2296258wrq.348.1585412644539; Sat, 28 Mar 2020 09:24:04 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id x1sm6439223wmj.24.2020.03.28.09.24.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Mar 2020 09:24:03 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH] drm/managed: Fix off-by-one in warning Date: Sat, 28 Mar 2020 17:23:58 +0100 Message-Id: <20200328162358.18500-1-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel test robot , "Rafael J. Wysocki" , Daniel Vetter , Laurent Pinchart , Thomas Zimmermann , Greg Kroah-Hartman , Daniel Vetter , Sam Ravnborg , Dan Carpenter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" I'm thinking this is the warning that fired in the 0day report, but I can't double-check yet since 0day didn't upload its source tree anywhere I can check. And all the drivers I can easily test don't use drm_dev_alloc anymore ... Also if I'm correct supreme amounts of bad luck because usually kslap (for bigger structures) gives us something quite a bit bigger than what we asked for. Reported-by: kernel test robot Fixes: c6603c740e0e ("drm: add managed resources tied to drm_device") Cc: Sam Ravnborg Cc: Thomas Zimmermann Cc: Dan Carpenter Cc: Laurent Pinchart Cc: Neil Armstrong Cc: "Rafael J. Wysocki" Signed-off-by: Daniel Vetter Reviewed-by: Sam Ravnborg --- drivers/gpu/drm/drm_managed.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_managed.c b/drivers/gpu/drm/drm_managed.c index 4955241ceb4c..9cebfe370a65 100644 --- a/drivers/gpu/drm/drm_managed.c +++ b/drivers/gpu/drm/drm_managed.c @@ -139,8 +139,7 @@ void drmm_add_final_kfree(struct drm_device *dev, void *container) { WARN_ON(dev->managed.final_kfree); WARN_ON(dev < (struct drm_device *) container); - WARN_ON(dev + 1 >= - (struct drm_device *) (container + ksize(container))); + WARN_ON(dev + 1 > (struct drm_device *) (container + ksize(container))); dev->managed.final_kfree = container; } EXPORT_SYMBOL(drmm_add_final_kfree);