From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B8D52C44508 for ; Wed, 15 Jul 2026 13:05:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lists.linux.it; i=@lists.linux.it; q=dns/txt; s=picard; t=1784120740; h=to : date : message-id : in-reply-to : references : mime-version : subject : list-id : list-unsubscribe : list-archive : list-post : list-help : list-subscribe : from : reply-to : content-type : content-transfer-encoding : sender : from; bh=I27jiW61yVNjtC43onOeJgvtYXiiJZBQVAy5ivrioOQ=; b=OOYZvVIfmSIaXrRX6eHkxCOSjk9SMG2pua62NVuEU16geLhnSI6BFHLGmcrVOMwGHg4sS AlyGRQZo/T5uWx37LUfhq+Wi6kjU0lxl9aMd9kjIax7lafNUHIy2IY4jq51bQqhAaSs6PJ0 i5ZVYXbX98jllqPFrs/mymK1SMU1RrA= Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 271513C5717 for ; Wed, 15 Jul 2026 15:05:40 +0200 (CEST) Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [IPv6:2001:4b78:1:20::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 7D9C63E5693 for ; Wed, 15 Jul 2026 15:05:02 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-3.smtp.seeweb.it (Postfix) with ESMTPS id DC05D1A007E3 for ; Wed, 15 Jul 2026 15:05:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1784120699; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VSJ1LKdl7jWstOeV1YbNePEmqGLbFEG7tYYFIdWlEFY=; b=TTAG3svy+1Gs0Ymo5CDp4o5Nv4RTrmYujk8c3fps0q9ByYxKx1k8D78mQ6aKU1QSrNduS4 wmh1Q6BnXGi8vOFQfBrBC21T2Q3D92I6Qy11ZGhSDGRTNnEYMib5aUtrWixdCOz8Ufq6Lq +pTx10EhecK2T5lcmv2kdqEhw6YyH/g= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-554-0O07MOSeNaeDS74Ux9-XUA-1; Wed, 15 Jul 2026 09:04:58 -0400 X-MC-Unique: 0O07MOSeNaeDS74Ux9-XUA-1 X-Mimecast-MFC-AGG-ID: 0O07MOSeNaeDS74Ux9-XUA_1784120697 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A679618001FB for ; Wed, 15 Jul 2026 13:04:57 +0000 (UTC) Received: from tdzik-thinkpadt14gen6.tpbc.csb (unknown [10.43.3.29]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 17A0B41C for ; Wed, 15 Jul 2026 13:04:56 +0000 (UTC) To: ltp@lists.linux.it Date: Wed, 15 Jul 2026 15:04:46 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: Gq0gJM6ehw6PSwLBSt7QUiFDGhhW-xx75dQOIiAshiY_1784120697 X-Mimecast-Originator: redhat.com X-Virus-Scanned: clamav-milter 1.0.9 at in-3.smtp.seeweb.it X-Virus-Status: Clean Subject: [LTP] [PATCH 1/3] LTP/Lite test float_trigo core dumps due to free(): invalid pointer X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Tomas Dzik via ltp Reply-To: Tomas Dzik Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ltp-bounces+ltp=archiver.kernel.org@lists.linux.it Sender: "ltp" Function read_file() does not initialize *data on failure paths (for example if malloc() fails) and caller ends up calling SAFE_FREE() on an uninitialized pointer. Here is the log from failed run: ~==== float_trigo ==== command: float_trigo -v float_trigo 0 TINFO : Using /tmp/LTP_floJSug25 as tmpdir (xfs filesystem) float_trigo 1 TPASS : Test passed float_trigo 0 TINFO : float_trigo: will run for 500 loops; using . as a data directory float_trigo 0 TINFO : float_trigo: will run 7 functions, 20 threads per function float_trigo 0 TINFO : signal handler 140451533870784 started float_trigo 0 TINFO : Signal handler starts waiting... free(): invalid pointer Duration: 0.926 This fix initializes pointers where we actually core dumped (*din, *dex). Signed-off-by: Tomas Dzik --- testcases/misc/math/float/thread_code.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/testcases/misc/math/float/thread_code.c b/testcases/misc/math/float/thread_code.c index ca18cef1e..6f3a463dd 100644 --- a/testcases/misc/math/float/thread_code.c +++ b/testcases/misc/math/float/thread_code.c @@ -278,7 +278,12 @@ void *thread_code(void *arg) { TH_DATA *th_data = (TH_DATA *) arg; size_t fsize, fsize2, fsize3; - double *din, *dex, *dex2 = NULL; + /* + * If read_file() fails for whatever reason, these pointers might + * stay uninitialized. Initialize them to NULL, because SAFE_FREE() + * can handle it. + */ + double *din = NULL, *dex = NULL, *dex2 = NULL; int imax, index; fsize = read_file(th_data->th_func.din_fname, (void **)&din); -- 2.55.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp