From nobody Fri Mar 11 09:42:55 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 3132E1A08228; Fri, 11 Mar 2022 09:42:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KFLZm0cL9z4XQV; Fri, 11 Mar 2022 09:42:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646991776; 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; bh=+IyztVd+UzB6ZggTAP247QwNystXLh1i6mVthttwJIo=; b=NePbX5rvZrQ8XfgBK6Nd96XaZ2q0hnY1UqkXi/Q8qeEhHTekGwhGAQtZ+zBzqHh8Y+enZy MGuf5ycI88BiUxgXgagTCyalmd+u4TWTXnc61qG4DPwnvcEuBrHr0ac1PeF2LM8UAVa51n uSvaX0M3viENJ+Ltn96x+QBeIyhrGFdoLEMCLx61FYdCwDIkYol4/TVVfk2rCZDy8bpIiU hMRezGDsvOxD9EOQ2/sHjhz7GSKFo3L6Fv8xQWgtgl11L3zQ5yxYH0qhSn2A6XZd426rSk oVLlkZ38O1lm9kDoRWUSyanac9HYYC4LpGXRkpwEEXeivABB5gh5h3jQG9q+tw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E90BE16BCD; Fri, 11 Mar 2022 09:42:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 22B9gtb2032440; Fri, 11 Mar 2022 09:42:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22B9gtat032439; Fri, 11 Mar 2022 09:42:55 GMT (envelope-from git) Date: Fri, 11 Mar 2022 09:42:55 GMT Message-Id: <202203110942.22B9gtat032439@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 3322d1c0e254 - main - ps(1): Use calloc instead of malloc and memset. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3322d1c0e25448563497acaa5c2358fe465765b8 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646991776; 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; bh=+IyztVd+UzB6ZggTAP247QwNystXLh1i6mVthttwJIo=; b=TANiz98mS71+XiyhssNgB2JWyvex88++M5Bf4yHavRBjViPdiX4r839rG21/RP/5k33eGe 94JuTGvdpy9nfE+JIn/UaX1MA/0YSEQYxUPEOpykSvRlP+vLcquJa3K1l+OzADYllxS550 SZFC0KXOXmJgGdk/fZwuG32OmQQfbi6iq0RmQIUmepoe/T9oRxyUnGpQpuO+qRgamSLQb2 L+9oIiOyC4UIXA2Q293zA7mjju9kSrvcMs4Hv2K2WZ+qKHjNlxfudmgyrmwCuws5n0XPIB bE0p4ApUWz01krEoTn6C7xUthfl6/Pghht43/Bbwx8GJAC6g73rAxj3mqCi8Ng== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1646991776; a=rsa-sha256; cv=none; b=wJot6MdApnnYBdxWdmjPDX5DWEK4hQOTc6hyrQpVVyAoR0ffZO3pnAfOXV6vvRFDgBCDQm vTa0jWUYyvu6+zAEcU/9QRR4l0Yzixj2jktszNcwl3YRGDdMADD6VqGwvZkCNi9QmEwYfD +9/rjGEWrsrlfbvyK8hkHgnKb7/S5Fjw9hQphHwlOPLyo6UtocpmrNUMDGL/5/W2Vk5pcP djGuAXil5/txerZ17LHj4eRQR1BrVp7NWSGg1zXy6aZs7xDHmRbtxv0xDspnsd/27z2X6k ZNHt5h/ZrlAFCLnemdrGzTRMQUsJDuqIfYzbk+rfaD5PvoUFDA16pDSAEGRpCg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=3322d1c0e25448563497acaa5c2358fe465765b8 commit 3322d1c0e25448563497acaa5c2358fe465765b8 Author: Alfonso AuthorDate: 2021-10-04 16:46:57 +0000 Commit: Hans Petter Selasky CommitDate: 2022-03-11 09:36:00 +0000 ps(1): Use calloc instead of malloc and memset. Pull Request: https://github.com/freebsd/freebsd-src/pull/546 MFC after: 1 week Sponsored by: NVIDIA Networking --- bin/ps/ps.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/ps/ps.c b/bin/ps/ps.c index 0c656d8a1544..89d90b78f2b0 100644 --- a/bin/ps/ps.c +++ b/bin/ps/ps.c @@ -1096,8 +1096,7 @@ descendant_sort(KINFO *ki, int items) * Now populate ki_d.prefix (instead of ki_d.level) with the command * prefix used to show descendancies. */ - path = malloc((maxlvl + 7) / 8); - memset(path, '\0', (maxlvl + 7) / 8); + path = calloc((maxlvl + 7) / 8, sizeof(unsigned char)); for (src = 0; src < items; src++) { if ((lvl = ki[src].ki_d.level) == 0) { ki[src].ki_d.prefix = NULL;