From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C79743DB324; Mon, 17 Aug 2026 15:28:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786980522; cv=none; b=bigEff5bEzbRfGfhnObIYihwLGnm37RjbWGikGoR6Bnd5kL4LeiuWOlffHoXGSMPBCMy2coMbX4/M3/TcsVVvIBMs4QY45U59rPDH31WEUfrUQXiSSgW/a5w0atYTK4XC9zx5YETNjXUdOhPHmabXuegg+IDWZWjkBnUeLjga5o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786980522; c=relaxed/simple; bh=cCg57wDYy4jzmKo9Og4L36ZLLYc+m7Ex23s6RUT9kpE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pm80GQ8RY97DB4r3JxTbddvPXn4kRr+p7Rjk/TFZQA9QuVTbfnsa0Bv1qZbPybFBrVr5EOsJR7O1ODAsHziALQPcuQNT438haPi1tFSWq2NhYGNFqxfKmM0yJUnTU9vOklR1MMTRA0yCaUFJBEyNcht4inTCrr4NAqhzUNGJlaU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=lDjvLGvC; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="lDjvLGvC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B6181F000E9; Mon, 17 Aug 2026 15:28:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786980521; bh=o3CehhxiFKd2ntkjmv8JpR8gY5kBvT5C7M4NbMg9feg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=lDjvLGvCUUBFhjJEOmoYNqItqonOv4l5ct3oHjXVllzlPs+tNIFM88+GAaa5Jngvl Ki9i2nCP1ieQ6X0Lr//JvSY8zOxhKMF/t5KJOzdyQzs8u3oFE6Mx+0h3Laa3LlGmXh WQdhsLRlua+sd6DHDQ77v34/Wl5O1M2wVZbnjJa8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Xu Rao , John Garry , "Martin K. Petersen (Oracle)" Subject: [PATCH 6.1 601/609] scsi: scsi_debug: Negate wrapped memcmp() result Date: Mon, 17 Aug 2026 15:34:57 +0200 Message-ID: <20260817132603.743896510@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260817132543.039278408@linuxfoundation.org> References: <20260817132543.039278408@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Xu Rao commit c4f6916a99cf105c3ff340b6210fcbba3fa66b35 upstream. comp_write_worker() returns true when the compared data matches. memcmp() returns zero for equal data and non-zero for different data, so its result must be negated before it is stored in a bool. The first segment already uses !memcmp(), but the wrapped segment uses memcmp() directly, reversing the match result. Use !memcmp() there as well. Fixes: 38d5c8336e60 ("scsi_debug: add Report supported opcodes+tmfs; Compare and write") Cc: stable@vger.kernel.org Signed-off-by: Xu Rao Reviewed-by: John Garry Link: https://patch.msgid.link/E5AD42E9C0E18633+20260803095328.3445311-1-raoxu@uniontech.com Signed-off-by: Martin K. Petersen (Oracle) Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/scsi_debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -3089,8 +3089,8 @@ static bool comp_write_worker(struct sde if (!res) return res; if (rest) - res = memcmp(fsp, arr + ((num - rest) * lb_size), - rest * lb_size); + res = !memcmp(fsp, arr + ((num - rest) * lb_size), + rest * lb_size); if (!res) return res; if (compare_only)