[{"id":3669165,"web_url":"http://patchwork.ozlabs.org/comment/3669165/","msgid":"<69c403b7.050a0220.1389b1.789b@mx.google.com>","list_archive_url":null,"date":"2026-03-25T15:48:07","subject":"Re: [LTP] [PATCH v5] open: fix cleanup condition and use snprintf","submitter":{"id":82886,"url":"http://patchwork.ozlabs.org/api/people/82886/","name":"Andrea Cervesato","email":"andrea.cervesato@suse.com"},"content":"Hi Jinseok,\n\n> static void cleanup(void)\n> {\n>-\tif (!first || !fds)\n>-\t\treturn;\n>+\tif (first >= 0) {\n>+\t\tint limit = fds_limit - first;\n>\n>+\t\tfor (int i = 0; i < limit; i++) {\n>+\t\t\tif (fds[i] != -1)\n>+\t\t\t\tSAFE_CLOSE(fds[i]);\n>+\t\t}\n>+\t}\n>\n>-\tif (fds)\n>-\t\tfree(fds);\n>+\tfree(fds);\n\nIf SAFE_MALLOC() fails, the fds == NULL and we have a wrong memory\naccess. Please change the condition to:\n\n\tif (first >= 0 && fds) {\n\n> static int *fds;\n> static char fname[20];\n\nThis was pre-existing and I didn't noticed. We should use PATH_MAX\nin here, instead of a pre-defined length.\n\nRegards,\n--\nAndrea Cervesato\nSUSE QE Automation Engineer Linux\nandrea.cervesato@suse.com","headers":{"Return-Path":"<ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it>","X-Original-To":["incoming@patchwork.ozlabs.org","ltp@lists.linux.it"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","ltp@picard.linux.it"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=lists.linux.it header.i=@lists.linux.it\n header.a=rsa-sha256 header.s=picard header.b=GSTmgcRE;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=suse.com header.i=@suse.com header.a=rsa-sha256\n header.s=google header.b=XUif1GrM;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it\n (client-ip=2001:1418:10:5::2; helo=picard.linux.it;\n envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it;\n receiver=patchwork.ozlabs.org)"],"Received":["from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fgrsV6ZBVz1xy3\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 26 Mar 2026 02:48:14 +1100 (AEDT)","from picard.linux.it (localhost [IPv6:::1])\n\tby picard.linux.it (Postfix) with ESMTP id C3ACD3E5529\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 25 Mar 2026 16:48:12 +0100 (CET)","from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [217.194.8.7])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature ECDSA (secp384r1))\n (No client certificate requested)\n by picard.linux.it (Postfix) with ESMTPS id 472AA3C2C33\n for <ltp@lists.linux.it>; Wed, 25 Mar 2026 16:48:09 +0100 (CET)","from mail-wm1-x331.google.com (mail-wm1-x331.google.com\n [IPv6:2a00:1450:4864:20::331])\n (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by in-7.smtp.seeweb.it (Postfix) with ESMTPS id B3E7B2005D6\n for <ltp@lists.linux.it>; Wed, 25 Mar 2026 16:48:08 +0100 (CET)","by mail-wm1-x331.google.com with SMTP id\n 5b1f17b1804b1-4852a9c6309so384435e9.0\n for <ltp@lists.linux.it>; Wed, 25 Mar 2026 08:48:08 -0700 (PDT)","from p200300ef2f4fc9002ac0653bb49440e6.dip0.t-ipconnect.de\n (p200300ef2f4fc9009ff26ae1d4042002.dip0.t-ipconnect.de.\n [2003:ef:2f4f:c900:9ff2:6ae1:d404:2002])\n by smtp.gmail.com with ESMTPSA id\n 5b1f17b1804b1-48717319272sm34584105e9.8.2026.03.25.08.48.07\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 25 Mar 2026 08:48:07 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=lists.linux.it;\n i=@lists.linux.it; q=dns/txt; s=picard; t=1774453692; h=message-id :\n to : in-reply-to : date : subject : list-id : list-unsubscribe :\n list-archive : list-post : list-help : list-subscribe : from :\n reply-to : cc : mime-version : content-type :\n content-transfer-encoding : sender : from;\n bh=7W/+enJgSJX7QnXn0QfTuqlCOpfClUsjmJ44x58iuTk=;\n b=GSTmgcRE9eHmIXZUQn5GypNqhOELJisJjSWiNLH3FxiJSVdzSn/MMGfSqfvissXsXjF+b\n gWaB3qPEYk9EY3SwJxRrIeioCWhLFEvEvbuoXgVTd5j/dj11PgqYK6Rd9FbY3+wpgl/dcgF\n SI3+3IIj9eUkq/U6kadKhgG4Gkj/nJM=","v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=suse.com; s=google; t=1774453688; x=1775058488; darn=lists.linux.it;\n h=date:content-transfer-encoding:subject:in-reply-to:cc:to:from\n :message-id:from:to:cc:subject:date:message-id:reply-to;\n bh=VlIRiL00bUDXNqDXc3XegcjGeUXSqG5j0aHWbWTOJKg=;\n b=XUif1GrMWiNQ3kPTtyxPPY1+zkpUpDkzhssNtrdHzj0eGKDD6EN/x87p9WLVxQX9qh\n YnSuK41y56isn/vwpQ3uODI4p4qR3LjVtOCvDDyLPk4XTb+p/rMrBLCbyElHyv9b4SsW\n 5pNwgvW9qywN5JYCbE5Bu7EAV1uRUDouoGUNrWe3gHIwfxcTNjVEJ1/ju5YS0+psp+qY\n 4ow1cgIZpcGUwWvvskJzxqUGk9VKZo40fp2+ZkJx3FgywciUcph3H/VfVNBPIPZgVBdI\n GFhy1ha/max4fpGc0o3s+rbL5FKTcIB9ooDSIKZXs1JNDXFWlFfbgiKsLuZQMaS/kJXl\n LJzw=="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1774453688; x=1775058488;\n h=date:content-transfer-encoding:subject:in-reply-to:cc:to:from\n :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=VlIRiL00bUDXNqDXc3XegcjGeUXSqG5j0aHWbWTOJKg=;\n b=HqmD9NKvVge6XPPSoIg+RscuTwyQzbiUulHFvhMYNEy1kioVb/1j0umL2C0JR7fM3M\n iNMoco4ixQcM/O1glSbmsHjPm5z4yiPKwnYiMIhutcHvH1g8g2g4juoQKuAIEZcsjab2\n Z1gCDluYu24uZ0lGtww4fbSrcExa+txvhbD/6ebrzxfID+TzIyuZ2fhANzmXm8u/CIBs\n mMZvwO7hoqzbBeoBBbchUUXA+L+dlExvoM0GGQhA0VE5vrmPGxmjWGF5H5LlivS528sj\n 2/OBJzr60e8lqr5Z/N8fB0c8YT4954Re0iNtbi89Odz2nR3ZI+Knvhiqd/MUefCsa1mi\n 7Epg==","X-Gm-Message-State":"AOJu0YyB0d3Qu49NFFDd9wkAFEvqTIJZBLbWt8rAhX57inz7p4rS0+sI\n xuPt29mwkemmP2hRtvCwCnh7QY+tRrIVE8FMQtWwWMNhRVnvP46UqhgzLkimWfSPb/k=","X-Gm-Gg":"ATEYQzxNADE3a16CyPcUqwNOyZ599r5T0cNrm1nCtiiJI9jZvIIWFlN9gnN3WzfLDeL\n KmakNqjM66UZEta31zMpVWLUSn938TFQUdrec5Otros933dN6OESBS0CcvPERBI16/JlMgTRtJG\n P9BrkCS3qunBVI2xXfRZbctjMaRGxcX/yRPZtjCod9mLBM9nXqc9taSb2qLpGk62r98JqkSzwUH\n Uu/ma0eThpRR9VteBkjXWCYU5eyKTIKqAPy5vVkFBR4h7ooFdbA3BZrtala36DslClONYW5aW2Z\n pQ4tY7GxRfnksz4QpvNObSfv8Ct+D7gtfJflvBF0qZ+eWwcidsU37WzXBL1mMml72EUbciTv8ut\n FS42/LJd5T0RtlA5gaizCLT4kNj4EF/PgG0QZEDQlEdTay0ETf7+1fth0Dn8zN9Y4kE/c6Wcvpq\n IfnDj7qE5FaCSz2UF00AJQmO7bnotcmtoE55yJkSzZHvVPpPKjPFtV0UflClHSXh7gAS5pYihFP\n 1wMJ6qGjgbNiIBoBXvYXN333toho/e9pe13opeMsHDtdwDKE0qgigCaAuaBg+CwLIeC2nT2erwD\n 7g==","X-Received":"by 2002:a05:600c:c16e:b0:485:3dfc:569 with SMTP id\n 5b1f17b1804b1-48716042b0emr59476265e9.16.1774453688061;\n Wed, 25 Mar 2026 08:48:08 -0700 (PDT)","Message-ID":"<69c403b7.050a0220.1389b1.789b@mx.google.com>","To":"\"Jinseok Kim\" <always.starving0@gmail.com>","In-Reply-To":"<20260325122207.1967-1-always.starving0@gmail.com>","Date":"Wed, 25 Mar 2026 15:48:07 +0000","X-Spam-Status":"No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID,\n DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no\n autolearn=disabled version=4.0.1","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on in-7.smtp.seeweb.it","X-Virus-Scanned":"clamav-milter 1.0.9 at in-7.smtp.seeweb.it","X-Virus-Status":"Clean","Subject":"Re: [LTP] [PATCH v5] open: fix cleanup condition and use snprintf","X-BeenThere":"ltp@lists.linux.it","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"Linux Test Project <ltp.lists.linux.it>","List-Unsubscribe":"<https://lists.linux.it/options/ltp>,\n <mailto:ltp-request@lists.linux.it?subject=unsubscribe>","List-Archive":"<http://lists.linux.it/pipermail/ltp/>","List-Post":"<mailto:ltp@lists.linux.it>","List-Help":"<mailto:ltp-request@lists.linux.it?subject=help>","List-Subscribe":"<https://lists.linux.it/listinfo/ltp>,\n <mailto:ltp-request@lists.linux.it?subject=subscribe>","From":"Andrea Cervesato via ltp <ltp@lists.linux.it>","Reply-To":"Andrea Cervesato <andrea.cervesato@suse.com>","Cc":"ltp@lists.linux.it","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it","Sender":"\"ltp\" <ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it>"}}]