Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp537792ybi; Thu, 30 May 2019 02:41:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqyzvsAvhh5GgVzSZu74tewfb15D2ut28P3LbqrhuzJmPhBdToktrms+4GrtjPr98yrU5hR3 X-Received: by 2002:a65:5c88:: with SMTP id a8mr2861064pgt.388.1559209285450; Thu, 30 May 2019 02:41:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559209285; cv=none; d=google.com; s=arc-20160816; b=pI32uPRZ+O45ea9p/vEHtvCfGFmT+xl9Gz3KgyvsQTsiYu9aBqgQmdPnOBcmjDx9OI Tjo24WUTQCGQJxMhx5iJUCqC+f8TGZyuBr8Hdd0cjDlkJQrLZY+weRygxG/HxlQvz38H wo8QzQ7aFi1EOxgaLG1+1WUhnMkbOSrGVMGnzmURp0GAa9NymOhp5LdQ/HkZucKPQRV6 1DVMt5ToBUxqVColSq21t8X8CSzc6gobNqPOHMVfhOgeoCuvZGHmBi/WhLiFUvjoMM/h RJyAcd6sNMpYfzu3MkXGDgHrX87XRIcZmWupUI/iQM7a50yv1rAIAcQ6jC1+VHObuDw8 khWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=HcywUzafthk86hjeemS/uZ4aa4I/rB7ZSDQIqK7Pq20=; b=0lkBnt+FJKL4JuaD+lgA+bUJhcLD42N6b/pHijTZ16UleFFyw8rLMJri3eNuU0vmE/ srVSA2qPCuHpPNS5AqF7hEmqY6AVQNjJibD1PureY8ZSRO9r65CPVU0kiYHxi5fTyZST cpqgybQ3SNFyX6PBqakSxL33UaFW6bV+aiP2gB8bRMSa5drvRDoZnMLro/JOjBWJv8R+ tWrL0sdmfnOms4a9411dOfEOZAf/34BlajpxmfAjFOBi1QizU1wkFYjMY6TX+CsB5P3l VwJ5NElhaZsZdiz6QamkEDlcslMQEsmSFWzEcFiZ9YVf3RC1+HPQTIS/JiANORxEqvCP v1rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=c3Bb8oqw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y21si2626930plp.151.2019.05.30.02.41.09; Thu, 30 May 2019 02:41:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=c3Bb8oqw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727629AbfE3Jjy (ORCPT + 99 others); Thu, 30 May 2019 05:39:54 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:43766 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726985AbfE3Jjy (ORCPT ); Thu, 30 May 2019 05:39:54 -0400 Received: by mail-pl1-f195.google.com with SMTP id gn7so2320472plb.10 for ; Thu, 30 May 2019 02:39:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=HcywUzafthk86hjeemS/uZ4aa4I/rB7ZSDQIqK7Pq20=; b=c3Bb8oqw0+cZD/QgsmjCpekCRp/AVMOGqdApc4y9rNsgMnTcXMgz8tnBf3/+Cj7k6T NIdNUTXwVKHigk5KtI0yg1j/9nuGiqfpNEDrZgTwdYLjNib0JOv/VNzalmvZhTogwQty HtEYGpvaxGab60FTfcg+WTCzHSQbQPulUFyigo3P4R02UVIPIxXfTanPHDfFjQfFsaXF Wdthl91xgfYRfyBkoi1ZGEvaeMZRrqxKAfGqtLaYBJcn/muKFm7XAQY6ABNxFkp+//fY QgurnwIZfWDUbW0kKlL4G1a6YHfnYc0TIkIsqaTjHpmUJ7FNZ9tDanezN+7UiXpFQSSX Dujg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=HcywUzafthk86hjeemS/uZ4aa4I/rB7ZSDQIqK7Pq20=; b=Xa+hshz5QHxs76axez8qRa0P5APCC1Ta4XxGvnoAS8cs70agMXJYImg9DwnuHPXxjE RsOLRCrNvIjur5m35rRwdQQ+0cBL7Xf/U5tLAnAVoHB1YGbcgKjAeY946k7MBG3uopbh BBTRwX+MQXxL2y4Va61Tpss/a0qc1ZIb+ihK4e/9hli8zXPn95sLuRLipuUuq868dlk/ Zs+9+V719XkngOfstAkiXQo6hMfsPxFsRL9GpxQI08ccTy7+7nRGaT0CEB7ljZZLGBAi 6LKbpT3pKj3Vh4ogzxfm/sDfXg2L9a8VAp7h9TCK3vb0iI0dlDOdD0pxCrZrmobsHDy5 OtAw== X-Gm-Message-State: APjAAAX044F03XeBEx7LehorE0sqTqCy88Tc/Rh/0AuiS+j5yJOB9iGH V4Gli/PlGYLn02Xdo1PFMTLa09xVH8g= X-Received: by 2002:a17:902:868a:: with SMTP id g10mr2863971plo.205.1559209194197; Thu, 30 May 2019 02:39:54 -0700 (PDT) Received: from zhanggen-UX430UQ ([66.42.35.75]) by smtp.gmail.com with ESMTPSA id 4sm2605152pfj.111.2019.05.30.02.39.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 May 2019 02:39:53 -0700 (PDT) Date: Thu, 30 May 2019 17:39:37 +0800 From: Gen Zhang To: inaky.perez-gonzalez@intel.com Cc: linux-wimax@intel.com, linux-kernel@vger.kernel.org Subject: [PATCH] wimax: debug: fix a missing-check bug in d_parse_params() Message-ID: <20190530093937.GA4457@zhanggen-UX430UQ> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In d_parse_params(), 'params_orig' is allocated by kstrdup(). It returns NULL when fails. So 'params_orig' should be checked. Signed-off-by: Gen Zhang --- diff --git a/include/linux/wimax/debug.h b/include/linux/wimax/debug.h index aaf24ba..bacd6cb 100644 --- a/include/linux/wimax/debug.h +++ b/include/linux/wimax/debug.h @@ -496,6 +496,11 @@ void d_parse_params(struct d_level *d_level, size_t d_level_size, if (_params == NULL) return; params_orig = kstrdup(_params, GFP_KERNEL); + if (!params_orig) { + printk(KERN_ERR "%s: can't duplicate string '%s'\n", + tag, _params); + return; + } params = params_orig; while (1) { token = strsep(¶ms, " ");