From patchwork Wed Mar 29 03:48:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 96178 Delivered-To: patches@linaro.org Received: by 10.140.89.233 with SMTP id v96csp2008958qgd; Tue, 28 Mar 2017 20:48:41 -0700 (PDT) X-Received: by 10.99.117.11 with SMTP id q11mr34184992pgc.9.1490759321175; Tue, 28 Mar 2017 20:48:41 -0700 (PDT) Return-Path: Received: from mail-pg0-x22c.google.com (mail-pg0-x22c.google.com. [2607:f8b0:400e:c05::22c]) by mx.google.com with ESMTPS id n73si4269510pfb.276.2017.03.28.20.48.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Mar 2017 20:48:41 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::22c as permitted sender) client-ip=2607:f8b0:400e:c05::22c; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::22c as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-pg0-x22c.google.com with SMTP id 21so3865215pgg.1 for ; Tue, 28 Mar 2017 20:48:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=B6bhnP5KZKnpqHVRFY3llfZSm7Bdi1flhi6NI5hFUw8=; b=etwfSS8Atlkq+mRgUuLQ7MEHWCRLh4K1/wo3WwAiKRLKLgc2mkYNcCRel3TM2BZvKa M0ajBb5glQW16jdHPe0rhMn6kwfHS2sIz9secpIVkL6doKwpzwg4Ro1TpmbgZwwo5TZQ k2wMIc8VDurW0htxe/DXshi9HnrE5kXxXSpcY= 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; bh=B6bhnP5KZKnpqHVRFY3llfZSm7Bdi1flhi6NI5hFUw8=; b=R/DFsd9RZQ7/0PyyoUPsW/gjODJOYZ9qJ+ajmJ6wxfUkkAKY9blD15F30KA5FrQLLj a0Sjpm5NA+1VZAtd3ZswdnIsqXmnBSYuXscjWCKqKHm+Yv5aRlAfkkEaRmc52EVxxhLK 3OBrinfUm/Z8JXKN1fPUnY+qqYdE1DVMwl/I67ojGeB+7FFkReWeVFOlDjPyS8LXlr9E HxJT7PPAg4jOPyQoYjfbh1z55Iwj/0cNIkE/KMfOpGtN8ohZpY2aLswwO2gymCGZ7abw 9fw9vBEhzccMk1/NXMfyGDMIC9Y39P46FkXf9eCMruzHcxmlEwJhH7zF9oL/BVOvqWEH +B8g== X-Gm-Message-State: AFeK/H1fbygoetA7IPoXePZQ7CVs89yqRLUlTu+29EGex+VQudeLHtIx6Jnj5BnelyYWyhOg/aU= X-Received: by 10.98.218.76 with SMTP id w12mr34309109pfl.162.1490759320825; Tue, 28 Mar 2017 20:48:40 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:1002:83f0:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id f3sm9926503pga.34.2017.03.28.20.48.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 28 Mar 2017 20:48:39 -0700 (PDT) From: John Stultz To: Cc: John Stultz , Rob Herring , Amit Pundir , Sumit Semwal , Vishal Bhoj Subject: [PATCH] external/drm_gralloc: Remove the invalid int cast and assignment in gbm_mod_perform() Date: Tue, 28 Mar 2017 20:48:36 -0700 Message-Id: <1490759316-11817-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In gbm_mod_perform(), for the cmd GRALLOC_MODULE_PERFORM_GET_USAGE, the code takes the third argument, casts it as an int* and then writes a zero into what the pointer points to. The problem with this is that the third argument to that function is actually a native_handle_t, so writing zero to the first int in that structure ends up overwriting the version value, causing the native_handle_t code to see the value as corrupt. This results in lots of warnings and leaked fds. Cc: Rob Herring Cc: Amit Pundir Cc: Sumit Semwal Cc: Vishal Bhoj Signed-off-by: John Stultz --- gralloc.cpp | 2 -- 1 file changed, 2 deletions(-) -- 2.7.4 diff --git a/gralloc.cpp b/gralloc.cpp index 01a1c6f..ec7638f 100644 --- a/gralloc.cpp +++ b/gralloc.cpp @@ -117,8 +117,6 @@ static int gbm_mod_perform(const struct gralloc_module_t *mod, int op, ...) /* TODO: This is a stub and should be implemented fully */ case GRALLOC_MODULE_PERFORM_GET_USAGE: { - int *buffer_usage = va_arg(args, int *); - *buffer_usage = 0; err = 0; } break;