Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp725918imm; Thu, 13 Sep 2018 06:53:43 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY9KHMZ5IltYbYZg5lS2y2OJizCehTTUjPh/7OwKevohDShYyLnV9130Bq5CY3cfPtN10ek X-Received: by 2002:a63:c245:: with SMTP id l5-v6mr7331925pgg.255.1536846823587; Thu, 13 Sep 2018 06:53:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536846823; cv=none; d=google.com; s=arc-20160816; b=FcVGOMqmdYJuX6BPUnzO9d4kEcWS4vL9lXsMvDU//2yWa77nF1BVc+pxKpH3W6Vog4 M6AZfTYceIUCuoXmAQIXZry9VWXUIX1qprAwjnCkXF3lmHu1dhIJgNMALY3jndIDpocr EO+f/+o5Zz4rCw0wilhvDZWbLP3cCxZ9FOn6qORxoRqvSFywm1/g+ewjIBlxEXxBqpS3 x6YxAzyWwXFbb0obd1Ezyd5UFCcaLDcq2AcPp3MmCUWkmwEEpahQOOLWZ1hjq2dFkRkO rIKWi+nviG48C4uymXLYRTP6eF0otvlAM6vQKdb08xCTPx3OAj73dYb3E0kf4Zt4qQGN 840Q== 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=JXv/lX3hDGnsN/yGTGFPDDLTxHfIsK/CrqX9L8JLqG4=; b=yROljg5e3VoA51Ne+CKSllziJpf4sdt3FAgtUdJs9dCAHFadYjCzNgs7j9PcikMsSv MXYUR8X06IO88xNQ0G7MvYG3tghf5RMRVOqIkQfpfqpZHJQuqDibKILYvk76J+019ClD g8IG0VLMUAmKnsX82PqHnvdlJUZJWByl6cLyxn71ZwKzOkLDv/5jXErxz/rmc2GvSi4A nZD5QLsThvDOWR8B/VdxicAMXVUE+gfsfG7iScoLKaKE2xjnkHn5tNI+c6I8jDlbfLSf KLq7+H3zHQiSqqj7AfVlP6Hpi8ll6rD6uKR24ynjw75Z/IJwRgBUW76Ur3ZW6i8eBU/a cdhA== 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 22-v6si4290454pfb.215.2018.09.13.06.53.28; Thu, 13 Sep 2018 06:53:43 -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 S1731103AbeIMTCt (ORCPT + 99 others); Thu, 13 Sep 2018 15:02:49 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33652 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730473AbeIMTCs (ORCPT ); Thu, 13 Sep 2018 15:02:48 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 62958D19; Thu, 13 Sep 2018 13:53:12 +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.18 051/197] scripts: modpost: check memory allocation results Date: Thu, 13 Sep 2018 15:30:00 +0200 Message-Id: <20180913131843.576886553@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131841.568116777@linuxfoundation.org> References: <20180913131841.568116777@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.18-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 @@ -672,7 +672,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; @@ -1318,7 +1318,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++ = '_'; @@ -1338,7 +1338,7 @@ static char *sec2annotation(const char * strcat(p, " "); return r; } else { - return strdup(""); + return NOFAIL(strdup("")); } } @@ -2036,7 +2036,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;