From patchwork Mon Mar 21 20:01:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maya Erez X-Patchwork-Id: 8635451 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CB20B9F36E for ; Mon, 21 Mar 2016 20:01:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0F01220204 for ; Mon, 21 Mar 2016 20:01:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0496D20268 for ; Mon, 21 Mar 2016 20:01:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757821AbcCUUBV (ORCPT ); Mon, 21 Mar 2016 16:01:21 -0400 Received: from wolverine02.qualcomm.com ([199.106.114.251]:51232 "EHLO wolverine02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757831AbcCUUBT (ORCPT ); Mon, 21 Mar 2016 16:01:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1458590478; x=1490126478; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=2gJ9mF8MvvqIjnrcjTgV8Dks/yrtLtTgDImZRUGfczY=; b=LVqsyKMCHlJQNe7H1Nc+ugEBFpFers1RGhL1uTcik/ezavUbvIDp6j/z cpR3jmi25mvWxaXId0XKNI/8mMm779WxSccn9dwAjwF7UrwKz2eRtaLmW QmOJv4PsKAlRjd0UZadjYV9cWGSzNc4aGI236NSgyBcf1EOIqvfPaN2G4 I=; X-IronPort-AV: E=Sophos;i="5.24,373,1455004800"; d="scan'208";a="273282938" Received: from ironmsg03-l-new.qualcomm.com (HELO Ironmsg03-L.qualcomm.com) ([10.53.140.110]) by wolverine02.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 21 Mar 2016 13:01:18 -0700 X-IronPort-AV: E=McAfee;i="5700,7163,8111"; a="1114910859" Received: from lx-merez.mea.qualcomm.com ([10.18.177.171]) by Ironmsg03-L.qualcomm.com with ESMTP; 21 Mar 2016 13:01:17 -0700 From: Maya Erez To: Kalle Valo Cc: Lior David , linux-wireless@vger.kernel.org, wil6210@qca.qualcomm.com, Maya Erez Subject: [PATCH 1/2] wil6210: allow empty WMI commands in debugfs wmi_send Date: Mon, 21 Mar 2016 22:01:11 +0200 Message-Id: <1458590472-677-2-git-send-email-qca_merez@qca.qualcomm.com> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1458590472-677-1-git-send-email-qca_merez@qca.qualcomm.com> References: <1458590472-677-1-git-send-email-qca_merez@qca.qualcomm.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Lior David There are many valid WMI commands with only header without any additional payload. Such WMI commands could not be sent using the debugfs wmi_send facility. Fix the code to allow sending of such commands. Signed-off-by: Lior David Signed-off-by: Maya Erez --- drivers/net/wireless/ath/wil6210/debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c index a4d3f70..b338a09 100644 --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ b/drivers/net/wireless/ath/wil6210/debugfs.c @@ -832,7 +832,7 @@ static ssize_t wil_write_file_wmi(struct file *file, const char __user *buf, u16 cmdid; int rc, rc1; - if (cmdlen <= 0) + if (cmdlen < 0) return -EINVAL; wmi = kmalloc(len, GFP_KERNEL); @@ -845,7 +845,7 @@ static ssize_t wil_write_file_wmi(struct file *file, const char __user *buf, return rc; } - cmd = &wmi[1]; + cmd = (cmdlen > 0) ? &wmi[1] : NULL; cmdid = le16_to_cpu(wmi->command_id); rc1 = wmi_send(wil, cmdid, cmd, cmdlen);