From patchwork Sat Apr 22 16:49:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maksim Salau X-Patchwork-Id: 9694449 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 95089600CA for ; Sat, 22 Apr 2017 16:49:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72A38280FC for ; Sat, 22 Apr 2017 16:49:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54F112819A; Sat, 22 Apr 2017 16:49:44 +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 308D5280FC for ; Sat, 22 Apr 2017 16:49:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1425700AbdDVQtm (ORCPT ); Sat, 22 Apr 2017 12:49:42 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:36433 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1425587AbdDVQtl (ORCPT ); Sat, 22 Apr 2017 12:49:41 -0400 Received: by mail-lf0-f66.google.com with SMTP id 75so12324318lfs.3 for ; Sat, 22 Apr 2017 09:49:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=b9SDU0zq8L0Bmpo/8Gto/Zly3wqloytpu1KvsdlWuoM=; b=nTB8BgCKHbjbOFzOlfzruOu2ZyWdkQmhIhA1piIcX8ewd8kHabvyQrGNl4WR14i31R LOIL+vjBmMttTzWLfDby2x+/slkgoAp+bmbc3KCC4eyt4NWDITlqfBK6R6b8enoFNltH I6X1LkCe8rAkfBuB/PajIbdNmf3UNuXhCUBdvi9tu3iwwWK+AwwK7If7vNnBihDosh4p BkEJbJjMIu6SCwm0roMZIWFPpzR9UYc5YuWnCU4z25JsyCtEE9ZyCT7JSW0AbAEditgD aDkvv1NYAw8WkyJ5w0JVABABGO4moha2+AAYy2d6J3E5dAjmFPek8laXePIu072J8PUu rdCw== 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=b9SDU0zq8L0Bmpo/8Gto/Zly3wqloytpu1KvsdlWuoM=; b=ZvAd0wXxqYH1aQ+wDpD2OKT/0/q0EBe2LAs+ylo8OeBWZww+G4Zsu490moBwkAhTlz fVLe/g01rDppjQopSI2BJehwesLuVfBPG7K9fN85yB7VHwiEUXTiS3Gj+qqLkY19SvgV mQt7vZBsltWMLrEsVqzD3WXUKKObfEvZtzyW+wCW1RmcW/IHBxoBzxIOheFt15xr8zN2 q0TKSg5GBzGDODpIWHzG2mA0CbmrW1HZSjiPWMv4vfbDL/nxYUEW17GcqwXjvzxw2q3e BN1qlyG61j9EKzLQq9wRCVLt8PlzayFApQgS5QdMaC+AenpSxFFACJ7/pFUl08kwH++J 7p9Q== X-Gm-Message-State: AN3rC/486wKhgDn1ZCMAqZPHMSW+DfvtBO0z50v4k9CSZeNDLCNZGs0t EJzIhjjRMl6Mdw== X-Received: by 10.46.22.76 with SMTP id 12mr6682231ljw.55.1492879780063; Sat, 22 Apr 2017 09:49:40 -0700 (PDT) Received: from localhost.localdomain (nat2-minsk-pool-46-53-195-202.telecom.by. [46.53.195.202]) by smtp.googlemail.com with ESMTPSA id u15sm2202139lfg.28.2017.04.22.09.49.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Apr 2017 09:49:39 -0700 (PDT) From: Maksim Salau To: Bernie Thompson , Bartlomiej Zolnierkiewicz , linux-fbdev@vger.kernel.org Cc: Maksim Salau Subject: [PATCH] video: fbdev: udlfb: Fix buffer on stack Date: Sat, 22 Apr 2017 19:49:22 +0300 Message-Id: <20170422164922.9472-1-maksim.salau@gmail.com> X-Mailer: git-send-email 2.9.3 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Allocate buffers on HEAP instead of STACK for local array that is to be sent using usb_control_msg(). Signed-off-by: Maksim Salau --- drivers/video/fbdev/udlfb.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/video/fbdev/udlfb.c b/drivers/video/fbdev/udlfb.c index e9c2f7b..1e83e19 100644 --- a/drivers/video/fbdev/udlfb.c +++ b/drivers/video/fbdev/udlfb.c @@ -1487,15 +1487,27 @@ static struct device_attribute fb_device_attrs[] = { static int dlfb_select_std_channel(struct dlfb_data *dev) { int ret; - u8 set_def_chn[] = { 0x57, 0xCD, 0xDC, 0xA7, + void *buf = NULL; + const u8 set_def_chn[] = { + 0x57, 0xCD, 0xDC, 0xA7, 0x1C, 0x88, 0x5E, 0x15, 0x60, 0xFE, 0xC6, 0x97, 0x16, 0x3D, 0x47, 0xF2 }; + buf = kmalloc(sizeof(set_def_chn), GFP_KERNEL); + + if (!buf) + return -ENOMEM; + + memcpy(buf, set_def_chn, sizeof(set_def_chn)); + ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), NR_USB_REQUEST_CHANNEL, (USB_DIR_OUT | USB_TYPE_VENDOR), 0, 0, - set_def_chn, sizeof(set_def_chn), USB_CTRL_SET_TIMEOUT); + buf, sizeof(set_def_chn), USB_CTRL_SET_TIMEOUT); + + kfree(buf); + return ret; }