From patchwork Mon Apr 9 21:07:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 10332027 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 400516022E for ; Mon, 9 Apr 2018 21:08:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 30E31287EA for ; Mon, 9 Apr 2018 21:08:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2427128947; Mon, 9 Apr 2018 21:08:11 +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=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 4EDAE287EA for ; Mon, 9 Apr 2018 21:08:10 +0000 (UTC) Received: (qmail 5328 invoked by uid 550); 9 Apr 2018 21:08:08 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 5308 invoked from network); 9 Apr 2018 21:08:07 -0000 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=slZtPyz+LsNcXsDn+uhw0xVjtelCqKDeFDkVIZDhiBQ=; b=P4gSNlBfx/zjioC1k2o9ez5eVjJF8wLaFBT1twzF9a7YHEqmFAirgMPbM8d2nMRZLG TFvojjQVqq3CFuN9F6yjf3ujWuk9GSbV1k7VRcA81H7xYxBqsOZuvKlCiaW0nwitqjuQ dxByFXez3oQrJdfIuOUstP3yhca1bRvdClvArZXBHHa8eljmYRcHgTrYsmDIPFrj9p0Z vEvhOUwshbe+K9xjbCg+W/C3e665K4Q46c/Al3xFOrLnGt7xBIgJaAiqR43to+95z7Vc UWm21tYGWhU5r8V/2yt3IYZKuteMtLTigYOzhh6I1kTGxu8Pc96KzbYSzkXYQgEajODp 89pg== X-Gm-Message-State: AElRT7HDUcHroXe1D0FwMgLRdnl0RTZ4yTHpit4i3y12isu8zgSOYQMb 8DVnqqPU7L/QANjLyinUMHlk99CPrB8= X-Google-Smtp-Source: AIpwx4/AQMNU7GcLgrjn3OeZTlAtgzEtzrZ4TTyrbqp25J9NomvadCt056YZttXL9ORyY+QaWG63QA== X-Received: by 2002:a17:902:264:: with SMTP id 91-v6mr40424580plc.178.1523308075996; Mon, 09 Apr 2018 14:07:55 -0700 (PDT) From: Laura Abbott To: Karsten Keil , "David S. Miller" Cc: Laura Abbott , Kees Cook , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com Subject: [PATCH] mISDN: Remove VLAs Date: Mon, 9 Apr 2018 14:07:47 -0700 Message-Id: <20180409210747.3990-1-labbott@redhat.com> X-Mailer: git-send-email 2.14.3 X-Virus-Scanned: ClamAV using ClamSMTP There's an ongoing effort to remove VLAs[1] from the kernel to eventually turn on -Wvla. Remove the VLAs from the mISDN code by switching to using kstrdup in one place and just using the upper bound in another. [1] https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Laura Abbott --- drivers/isdn/mISDN/dsp_hwec.c | 8 +++++--- drivers/isdn/mISDN/l1oip_core.c | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/isdn/mISDN/dsp_hwec.c b/drivers/isdn/mISDN/dsp_hwec.c index a6e87076acc2..5336bbdbfdc5 100644 --- a/drivers/isdn/mISDN/dsp_hwec.c +++ b/drivers/isdn/mISDN/dsp_hwec.c @@ -68,12 +68,12 @@ void dsp_hwec_enable(struct dsp *dsp, const char *arg) goto _do; { - char _dup[len + 1]; char *dup, *tok, *name, *val; int tmp; - strcpy(_dup, arg); - dup = _dup; + dup = kstrdup(arg, GFP_ATOMIC); + if (!dup) + return; while ((tok = strsep(&dup, ","))) { if (!strlen(tok)) @@ -89,6 +89,8 @@ void dsp_hwec_enable(struct dsp *dsp, const char *arg) deftaps = tmp; } } + + kfree(dup); } _do: diff --git a/drivers/isdn/mISDN/l1oip_core.c b/drivers/isdn/mISDN/l1oip_core.c index 21d50e4cc5e1..df594245deca 100644 --- a/drivers/isdn/mISDN/l1oip_core.c +++ b/drivers/isdn/mISDN/l1oip_core.c @@ -279,7 +279,7 @@ l1oip_socket_send(struct l1oip *hc, u8 localcodec, u8 channel, u32 chanmask, u16 timebase, u8 *buf, int len) { u8 *p; - u8 frame[len + 32]; + u8 frame[L1OIP_MAX_PERFRAME + 32]; struct socket *socket = NULL; if (debug & DEBUG_L1OIP_MSG)