Message ID | mvmcykq63vz.fsf@suse.de |
---|---|
State | New |
Headers |
Return-Path: <binutils-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4E1113858408 for <patchwork@sourceware.org>; Thu, 26 Sep 2024 11:39:36 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by sourceware.org (Postfix) with ESMTPS id 5E1AA3858D28 for <binutils@sourceware.org>; Thu, 26 Sep 2024 11:38:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5E1AA3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5E1AA3858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727350738; cv=none; b=gOrkD+D9KEX63N5VzMfKF7BSWfJBwnlqYnUIYahMVKIpRzWJJSBZxKVe0dtXa0pSdPR//wsLYALh/ZdFJsn5eQUalr4kqu4BiElnz6H7XVCcCi4V+cdEtTwQLnmyg29dGRVB9RY88cUsdWk3jxDhwcMbL8Qdr55mu5NVdH8voVk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727350738; c=relaxed/simple; bh=tBxl4NjxnQo8iw0iaqWX0susGfErCH9UaEx5noOC0Tg=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-ID:MIME-Version; b=Gs+A/hYhdE2srmQK4WEVsU19PrdPIWlHoBqYAdxmdVJcGKT11XHbq/RIRKo/VkrpjqChkL1IMgevvhRLw0mGDKI+keOBn8ZZqkdKtS7KGg6eplfeKL/n/pTxnd9GuEwP+JPCl2O0gbqNStXnBDogl3NjlG1oUzrr1Uo1ulycVZo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from hawking.nue2.suse.org (unknown [10.168.4.11]) by smtp-out2.suse.de (Postfix) with ESMTP id 633981F80A for <binutils@sourceware.org>; Thu, 26 Sep 2024 11:38:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1727350736; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=JMhAn0U6qU2mkKQSLQ0wiRkrMPUcf6AbAqnYunuFdxQ=; b=hDfLoq8JgLrsH1axz0k28FgFVgS4HM7bOL7dfjjMSZc+Yfs31Z9SU/yiPNXhoB2Hwa+TSe YDsreti9ZASY6ReZmyy4z3BahE0ZT5FqswqxYd38VES7/OjLru9A8zDSBdwgmlpec3FPgs G+Hyw0ETf8pacuF84L9LZa5J5wfm5hw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1727350736; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=JMhAn0U6qU2mkKQSLQ0wiRkrMPUcf6AbAqnYunuFdxQ=; b=yzf5saO3EeCdj12gC7nidcnh7IsmhU2WNBNbNBw7+KkKCYwWQMMTk22kJ7mSfTJFjUHhSB leP8yvboHWiNaHCA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1727350736; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=JMhAn0U6qU2mkKQSLQ0wiRkrMPUcf6AbAqnYunuFdxQ=; b=hDfLoq8JgLrsH1axz0k28FgFVgS4HM7bOL7dfjjMSZc+Yfs31Z9SU/yiPNXhoB2Hwa+TSe YDsreti9ZASY6ReZmyy4z3BahE0ZT5FqswqxYd38VES7/OjLru9A8zDSBdwgmlpec3FPgs G+Hyw0ETf8pacuF84L9LZa5J5wfm5hw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1727350736; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=JMhAn0U6qU2mkKQSLQ0wiRkrMPUcf6AbAqnYunuFdxQ=; b=yzf5saO3EeCdj12gC7nidcnh7IsmhU2WNBNbNBw7+KkKCYwWQMMTk22kJ7mSfTJFjUHhSB leP8yvboHWiNaHCA== Received: by hawking.nue2.suse.org (Postfix, from userid 17005) id 555E74A03E4; Thu, 26 Sep 2024 13:38:56 +0200 (CEST) From: Andreas Schwab <schwab@suse.de> To: binutils@sourceware.org Subject: [PATCH] Fix -Wstringop-overflow warning in ecoff_link_hash_newfunc X-Yow: Kids, don't gross me off.. ``Adventures with MENTAL HYGIENE'' can be carried too FAR! Date: Thu, 26 Sep 2024 13:38:56 +0200 Message-ID: <mvmcykq63vz.fsf@suse.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -4.20 X-Spamd-Result: default: False [-4.20 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-0.989]; MIME_GOOD(-0.10)[text/plain]; RCVD_NO_TLS_LAST(0.10)[]; ARC_NA(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_ONE(0.00)[1]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_DN_NONE(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email] X-Spam-Level: X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list <binutils.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/binutils>, <mailto:binutils-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/binutils/> List-Post: <mailto:binutils@sourceware.org> List-Help: <mailto:binutils-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/binutils>, <mailto:binutils-request@sourceware.org?subject=subscribe> Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org |
Series |
Fix -Wstringop-overflow warning in ecoff_link_hash_newfunc
|
|
Checks
Context | Check | Description |
---|---|---|
linaro-tcwg-bot/tcwg_binutils_build--master-arm | warning | Patch is already merged |
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 | warning | Patch is already merged |
Commit Message
Andreas Schwab
Sept. 26, 2024, 11:38 a.m. UTC
* ecoff.c (ecoff_link_hash_newfunc): Don't call memset if ret is NULL. --- bfd/ecoff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 26.09.2024 13:38, Andreas Schwab wrote: > * ecoff.c (ecoff_link_hash_newfunc): Don't call memset if ret is > NULL. > --- > bfd/ecoff.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/bfd/ecoff.c b/bfd/ecoff.c > index 04501761bd6..5ee7ffaf489 100644 > --- a/bfd/ecoff.c > +++ b/bfd/ecoff.c > @@ -3278,8 +3278,8 @@ ecoff_link_hash_newfunc (struct bfd_hash_entry *entry, > ret->abfd = NULL; > ret->written = 0; > ret->small = 0; > + memset ((void *) &ret->esym, 0, sizeof ret->esym); > } > - memset ((void *) &ret->esym, 0, sizeof ret->esym); > > return (struct bfd_hash_entry *) ret; > } Okay (and likely obvious anyway). I'd like to note though that the bad case can't happen in practice, afaict, as _bfd_link_hash_newfunc() won't ever return NULL when passed non-NULL. Jan
On Sep 26 2024, Jan Beulich wrote: > Okay (and likely obvious anyway). I'd like to note though that the bad case > can't happen in practice, afaict, as _bfd_link_hash_newfunc() won't ever > return NULL when passed non-NULL. Right, that's why I changed the original subject "Fix NULL pointer dereference" into this one. With enough of inlining the compiler should be able to figure that out by itself, though.
diff --git a/bfd/ecoff.c b/bfd/ecoff.c index 04501761bd6..5ee7ffaf489 100644 --- a/bfd/ecoff.c +++ b/bfd/ecoff.c @@ -3278,8 +3278,8 @@ ecoff_link_hash_newfunc (struct bfd_hash_entry *entry, ret->abfd = NULL; ret->written = 0; ret->small = 0; + memset ((void *) &ret->esym, 0, sizeof ret->esym); } - memset ((void *) &ret->esym, 0, sizeof ret->esym); return (struct bfd_hash_entry *) ret; }