From patchwork Fri Jun 17 18:57:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathias Krause X-Patchwork-Id: 9184781 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 89A31608A2 for ; Fri, 17 Jun 2016 18:57:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 619E027E33 for ; Fri, 17 Jun 2016 18:57:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 52A3827F07; Fri, 17 Jun 2016 18:57:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 98FA127E33 for ; Fri, 17 Jun 2016 18:57:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753475AbcFQS5Q (ORCPT ); Fri, 17 Jun 2016 14:57:16 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:34068 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751807AbcFQS5P (ORCPT ); Fri, 17 Jun 2016 14:57:15 -0400 Received: by mail-wm0-f66.google.com with SMTP id 187so79152wmz.1 for ; Fri, 17 Jun 2016 11:57:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=M2dPf4tr9GWUx+IGGAur7RFNIglK5pn/TOk9tD0UT14=; b=UulOUpOZ9/AMENrZB+is04tgk0hjZTh9Uwa0ccKveAO6ZW/g+38FtozVYhY5OrV3mY l3/4Ng2txfAQv3bnk4eOaLWbwcCFVCIafUDZW2FfFfB89kdH5QyzdddiVPfj5NOPx2Mf eq/sOuW67eH50DL0cBA5QC2uRFxnBFis0OwMdDhmTsmon0HxpmdKABa2fizvg32XrOiu XCkcS+5brJPBKL1aLAAutuWORYfo3zX+NWRznJdAmB6ixZG2WlxQgrdROXUeOlMjs2on v690P4N8ku1VIKbWHx3sYtxi4f+FKXrckn2BChcS+YAy74PxrbJEVsLORoyo6cExDUUF SfJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=M2dPf4tr9GWUx+IGGAur7RFNIglK5pn/TOk9tD0UT14=; b=jXSwUgNL8HqjG9MY3WNmjblGjB/OnwutpQNUZ92hrzfEQVwfy87kOQdnL0iRLvzwPe fmaHXeXfsJsBuKy+xr+BMAy9qqTxlEzXmOwifcJ3tQeomjIcYj2Epp+37vdqFBODyjXO UMrC0k5E52pGVLPpnH06afVuefY59jGMdKXZmT+snhQSjsAck7ct25KKA1SZUeU7Xntl WglE4hcGYPsHmaoD/amz3f4ZKWo4kctYtz7oStmqfkT3fnWf9BlYR67duQwT+mZ6Upd5 RsG0APR1RZv8kBgSc7m1JwF3GnO19c7vOO7qyeEFTSHOcpoWqU5WbEAIlBwT8yHDuKTt WUgg== X-Gm-Message-State: ALyK8tK/p17eZzKW0gYnE+qqbgPvis+rJx0RzNcILAAYWXZiCa326VGYWRH3WGDgZyCyoA== X-Received: by 10.28.20.139 with SMTP id 133mr35085wmu.19.1466189833940; Fri, 17 Jun 2016 11:57:13 -0700 (PDT) Received: from jig.fritz.box (p54B30F1D.dip0.t-ipconnect.de. [84.179.15.29]) by smtp.gmail.com with ESMTPSA id t190sm9063wmt.24.2016.06.17.11.57.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Jun 2016 11:57:13 -0700 (PDT) From: Mathias Krause To: Sumit Semwal Cc: linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, Mathias Krause , Daniel Vetter , PaX Team Subject: [PATCH] dma-buf: propagate errors from dma_buf_describe() on debugfs read Date: Fri, 17 Jun 2016 20:57:03 +0200 Message-Id: <1466189823-21489-1-git-send-email-minipli@googlemail.com> X-Mailer: git-send-email 1.7.10.4 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The callback function dma_buf_describe() returns an int not void so the function pointer cast in dma_buf_show() is wrong. dma_buf_describe() can also fail when acquiring the mutex gets interrupted so always returning 0 in dma_buf_show() is wrong, too. Fix both issues by casting the function pointer to the correct type and propagate its return value. This type mismatch was caught by the PaX RAP plugin. Signed-off-by: Mathias Krause Cc: Sumit Semwal Cc: Daniel Vetter Cc: PaX Team --- drivers/dma-buf/dma-buf.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 6355ab38d630..0f2a4592fdd2 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -881,10 +881,9 @@ static int dma_buf_describe(struct seq_file *s) static int dma_buf_show(struct seq_file *s, void *unused) { - void (*func)(struct seq_file *) = s->private; + int (*func)(struct seq_file *) = s->private; - func(s); - return 0; + return func(s); } static int dma_buf_debug_open(struct inode *inode, struct file *file)