Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp714787imm; Thu, 13 Sep 2018 06:43:33 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY9orJJWe/YHQ3ejsUdnVguVhVuLpp//x2GCT3DMQesE18uYpvXNtoJXrhnaCBzbHlPfNRO X-Received: by 2002:a17:902:b190:: with SMTP id s16-v6mr7565593plr.26.1536846213063; Thu, 13 Sep 2018 06:43:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536846213; cv=none; d=google.com; s=arc-20160816; b=prM49lFM/YkKC1P67Tkblip/oxhLguUOrg7rDYYzAsz6pXhdevgDMxcmsYY/lhwmd+ cokLYSrIu4MNJY2lNCvroPxayRAfO8fy2Z+rm6G0NdCRHWBA5Uf9aGjJ3/9WDV2Ds0Oi HQ4p7oBctDECvjX0e9KxbUVdMiPCVk+OSWTfoHFpBRqL2bfq2N1C7T60bqNEnj2NCjOe QEP07ZQT3ukjxacUCUSQ4Hg1ulyHc2Oa+9Dy3xMxD5cUEVUmF24o+bjtX0OKu6eC1z15 D7eP47AJc1GMf2fViz4EC7qRKyPLa2nAxd8QQCRM7k4sQ2jqnPZbGwjv9dtE7mZR1kkX fmUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=1nhmHcPjizKHZ/gMmx+rOo4TJf+4pTteomsW9DaI1a0=; b=Ww4RhRMFNVI3aoV/4hLodGSyeRIkfa0PSDQ6jgEZ3fDJpeE4GZAXSLwO3l4+jiKyaq W/+bloZr0eog1+CoTJ/pw0Xd70zPnrfNAut+zlcJMa2tkowzCCiDUtZCoJ/Ygh8NvlIr LKqoxqzwUqWHtyZd1kqvXnmwj7gabbQBDd5S+LvL1oc2zADcjYOiocSEiNFRMIHBCW/6 qvw0faDjXKjFv2S1iP3eIiAM6/rs+9UM/IZIcrGs2bJElETcFWvcVrEitbZ8iiLENoNv EsoF0e4F40zyqUhQ0Sw/QIliPVJEc4q7I+JWFfXRunYCO9xJVWodF3q+MmdYFI9iXTOQ 66Sw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l63-v6si3950169pgd.598.2018.09.13.06.43.18; Thu, 13 Sep 2018 06:43:33 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729612AbeIMSwb (ORCPT + 99 others); Thu, 13 Sep 2018 14:52:31 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60284 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727231AbeIMSwa (ORCPT ); Thu, 13 Sep 2018 14:52:30 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id CCA6ED19; Thu, 13 Sep 2018 13:42:57 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , Yuexing Wang , Masahiro Yamada , Sasha Levin Subject: [PATCH 4.14 030/115] scripts: modpost: check memory allocation results Date: Thu, 13 Sep 2018 15:30:50 +0200 Message-Id: <20180913131825.521822825@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131823.327472833@linuxfoundation.org> References: <20180913131823.327472833@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Randy Dunlap [ Upstream commit 1f3aa9002dc6a0d59a4b599b4fc8f01cf43ef014 ] Fix missing error check for memory allocation functions in scripts/mod/modpost.c. Fixes kernel bugzilla #200319: https://bugzilla.kernel.org/show_bug.cgi?id=200319 Signed-off-by: Randy Dunlap Cc: Yuexing Wang Signed-off-by: Masahiro Yamada Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- scripts/mod/modpost.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -677,7 +677,7 @@ static void handle_modversions(struct mo if (ELF_ST_TYPE(sym->st_info) == STT_SPARC_REGISTER) break; if (symname[0] == '.') { - char *munged = strdup(symname); + char *munged = NOFAIL(strdup(symname)); munged[0] = '_'; munged[1] = toupper(munged[1]); symname = munged; @@ -1329,7 +1329,7 @@ static Elf_Sym *find_elf_symbol2(struct static char *sec2annotation(const char *s) { if (match(s, init_exit_sections)) { - char *p = malloc(20); + char *p = NOFAIL(malloc(20)); char *r = p; *p++ = '_'; @@ -1349,7 +1349,7 @@ static char *sec2annotation(const char * strcat(p, " "); return r; } else { - return strdup(""); + return NOFAIL(strdup("")); } } @@ -2050,7 +2050,7 @@ void buf_write(struct buffer *buf, const { if (buf->size - buf->pos < len) { buf->size += len + SZ; - buf->p = realloc(buf->p, buf->size); + buf->p = NOFAIL(realloc(buf->p, buf->size)); } strncpy(buf->p + buf->pos, s, len); buf->pos += len;