From nobody Wed Nov 22 20:17:03 2023 X-Original-To: dev-commits-src-main@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 4SbCFq2JJpz51n0n; Wed, 22 Nov 2023 20:17:03 +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 4SbCFq1ZD4z4Q5h; Wed, 22 Nov 2023 20:17:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700684223; 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=dbmm3YhK+kKmk0ypzZCgQxVdqY1JalyrPYxCE+NBDzs=; b=GAb4J34UN1yADK5Fuo/aNWWJGK5QuiaO9LCdEZFmj1GzGyLUDZTJReyLvt6c3MmK2PYAMU rWZ48ERTgVo9cfpgMt7eZX4MdfpFduojm5LSqSNsqTaZ03WsJl5N7G6PT4vc6/zHT9itPS nXfk/GJQpwoGL/R+ns5NBGDbsH4sAqxyQG6lqM1Qkavhjw5WOBHA1k3vplZBToPyLa8bXR 1DVilpnOkL5rqHbqAFhe/N84LB0pU6UdCFDIIE5H9fcjyutu2khriyIThqloL1iBw3I6ed DeoAh+xea1uAS0Rg0gMPhBnvi56BJd5Z7AR7knhp2BXcq4j91QFoyVAwAfIOTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700684223; 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=dbmm3YhK+kKmk0ypzZCgQxVdqY1JalyrPYxCE+NBDzs=; b=DWRTGwW6sjq1U2uY8pRTnunnK09pTXiamjyY0EGyT/uzQxu7eqhRTjT9SZnbFGmDdvX/30 XTgeJV1igjoaAjI5j/VJa3Tak4UNY3HIURoE23rZiqybx+RsnRLqT/X+jow6yE1l8+bdRs OhRZdi8jDW18ZvwI7oIfSVf1zIAgi6X8quwOpKah+vGxG9R8i9ZPlvoS8YupX56/mY/d9c 74Eb5kLy1xF0vwefBOdX6WN2FeD5r9EfqzskxzNlJfUpMJHcxov+zVOR+nh5vhuiRAEngp O/1P5Kq9x4yzLZnwXtLTvrLaJBYXYGDH6U2bR2xlCzHZOhj1AgXObacrTfq5Fw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1700684223; a=rsa-sha256; cv=none; b=nZUBsHI/AG7peLvmejH9UMan0HW7W6AG5WDlc0zmYNmBQFgNWS07hIL1t2VdLmrsQ6uHcp het/Ytyq43HTaOp6+SEIMn8eBdP9a9zstbAr0+PEZyU+6unl3VTLJdsGsGIw0Su0GkTyqd FBdgE7iZKr7LmKv3XyCGsnOFxD3a86g/eaXXv2sBmIy4o3xYn+MYqOL4PLL+3SE/+4Llgp hPIJLXOnAOs+VS3MamXipAHBPSVxLYARAiUULM1VBk7jeBX/gH6Y2WEd0HMSTd3ZY5LBw5 BYXIQsFX5XjVK/A/AlQ6W4XzREr3fAfXtG9pVoCzlf7Y6/MSWfv62exc/qgYbw== 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 4SbCFq0cCWzY8j; Wed, 22 Nov 2023 20:17:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3AMKH3kV019986; Wed, 22 Nov 2023 20:17:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3AMKH3qS019983; Wed, 22 Nov 2023 20:17:03 GMT (envelope-from git) Date: Wed, 22 Nov 2023 20:17:03 GMT Message-Id: <202311222017.3AMKH3qS019983@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 6332e0f1a4b3 - main - CAM: Remove return value from xpt_path_sbuf() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6332e0f1a4b34707654d6ae2cd3c1e8799970d0b Auto-Submitted: auto-generated The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=6332e0f1a4b34707654d6ae2cd3c1e8799970d0b commit 6332e0f1a4b34707654d6ae2cd3c1e8799970d0b Author: Alexander Motin AuthorDate: 2023-11-22 20:10:57 +0000 Commit: Alexander Motin CommitDate: 2023-11-22 20:10:57 +0000 CAM: Remove return value from xpt_path_sbuf() It is wrong to call sbuf_len() on third-party sbuf. If that sbuf has a drain function, it ends up in assertion. But even would it work, it would return not newly written length, but the full one. Searching through the sources I don't see this value used. --- sys/cam/cam_xpt.c | 11 ++++------- sys/cam/cam_xpt.h | 4 ++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 83fef42453fa..22d6c89f5b46 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -3743,19 +3743,18 @@ xpt_print(struct cam_path *path, const char *fmt, ...) sbuf_delete(&sb); } -int +char * xpt_path_string(struct cam_path *path, char *str, size_t str_len) { struct sbuf sb; - int len; sbuf_new(&sb, str, str_len, 0); - len = xpt_path_sbuf(path, &sb); + xpt_path_sbuf(path, &sb); sbuf_finish(&sb); - return (len); + return (str); } -int +void xpt_path_sbuf(struct cam_path *path, struct sbuf *sb) { @@ -3786,8 +3785,6 @@ xpt_path_sbuf(struct cam_path *path, struct sbuf *sb) else sbuf_printf(sb, "X): "); } - - return(sbuf_len(sb)); } path_id_t diff --git a/sys/cam/cam_xpt.h b/sys/cam/cam_xpt.h index 3c8d385fe33b..06ef52580120 100644 --- a/sys/cam/cam_xpt.h +++ b/sys/cam/cam_xpt.h @@ -102,9 +102,9 @@ int xpt_path_comp(struct cam_path *path1, struct cam_path *path2); int xpt_path_comp_dev(struct cam_path *path, struct cam_ed *dev); -int xpt_path_string(struct cam_path *path, char *str, +char * xpt_path_string(struct cam_path *path, char *str, size_t str_len); -int xpt_path_sbuf(struct cam_path *path, struct sbuf *sb); +void xpt_path_sbuf(struct cam_path *path, struct sbuf *sb); path_id_t xpt_path_path_id(struct cam_path *path); target_id_t xpt_path_target_id(struct cam_path *path); lun_id_t xpt_path_lun_id(struct cam_path *path);