Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp4959530rdb; Fri, 29 Dec 2023 23:05:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IFy8+DuLvhNTK4TV4UxoIfWhaTeWht9EvsYfnvZa013aHh/06NQaHD0Mf3eOARKVA+h2Tb/ X-Received: by 2002:a05:6870:9a21:b0:1fb:75a:6d45 with SMTP id fo33-20020a0568709a2100b001fb075a6d45mr15616412oab.108.1703919927592; Fri, 29 Dec 2023 23:05:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703919927; cv=none; d=google.com; s=arc-20160816; b=Qt1eIWz5OXQUw1iScZRf3xtD3EZiL9Zt3v8EpTp4G3FetDFPNgus/KCYRDIex80szY 7ySFMSTCDGSMosS9jJZwPk05SNNxova7NW1GULfzhUBXUiWyr9mi6vIeCbprdZyPaVRX 4BJGVqUgpFrgzcmKfoYjfpTk5dEV3um5KC0DoYwT57cEjsiGtK+V9RVYnnnKno9LMrzE jxEWobxq6rN3JscupegBOImxR/MyrvEyoHWpa/37tD/yTQCyBXLQSAAz8YBSSR2q/h4L V/tzzIu9gZm7d5QOI7Ok/pFXIDfQMbqr+Gtn5GK4q9NQ/qcyBEaE9GKi9rF3RBZJRbyh Tu9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=lCcuT3/V5P8puSESqTVhTWhLQge1yX6nbfiL/GjuQ+U=; fh=yt//x1K0AElDRB7CQejL+12OXOUb3bqF/gF4Mhj/YP4=; b=HjD7xk5Fh/LaVJ2RrunL/1paQb+5JEbyBGjFiETkQRguI2yDTEM3fd8Rjyc+449W6z GM4m8Y09zNQhrLPlsJGhyIVzp0ZKaup/EwjM6Sw1tV6Rlv1LBzl2gCSvubB2jmrGJkGl HfNGuVCbYwmTIYJ8gpd0QPTtBhApcOeWsPiFHycMD7yaJ48xFKMsk4U4Q/d3FInM5WLY 1xva0ZX9HDS2s/3bruse03Jc2k0TYaMGaLSYiF/h4palMgAsrydb30b36EuOeokUzCEz Mpqw4HjjfZZ5g4mBlRXGOb3YrrhpjqDX/i3xWRFVRgVPhmVWlnXqGfo2+CV7kX47hLl9 0qtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@web.de header.s=s29768273 header.b=XjP1iojg; spf=pass (google.com: domain of linux-kernel+bounces-13347-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13347-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=web.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id j14-20020a63e74e000000b005cde388b355si15582060pgk.846.2023.12.29.23.05.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Dec 2023 23:05:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-13347-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@web.de header.s=s29768273 header.b=XjP1iojg; spf=pass (google.com: domain of linux-kernel+bounces-13347-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13347-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=web.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 868C2B2130A for ; Sat, 30 Dec 2023 07:05:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A292A4419; Sat, 30 Dec 2023 07:04:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b="XjP1iojg" X-Original-To: linux-kernel@vger.kernel.org Received: from mout.web.de (mout.web.de [212.227.17.11]) (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 0D85823BB; Sat, 30 Dec 2023 07:04:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=web.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1703919874; x=1704524674; i=markus.elfring@web.de; bh=zCHgF8mqJGlh0F14PrBAaelXu0eznOwtpnIZ2X+LMaA=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From: In-Reply-To; b=XjP1iojg5NqwgGosbEveIyKe69DQWoHVYrGemxAkxv1A+k7lwceGlW57TKY8nxYI +sDij5t4N9fGAM3tVWI8VbuJj+51lgP8hJGeuB+xwqtl2n9YAPV/551ijC/wxOCHl RHrOauhEbuyVIpnnjoA4x7Ob8uY60lpiafajJARIqtRkbzRlMAAMBr0yacC0bHpY+ bqEGW2i/JoPIXZeV63W/fGCUieAjTUxvuzyc/BIVh/2obYCohrlvlCn6I89HW7mbv 0FvVXeXCB7qpm6VrEe38SYtdUIORnn7jMG1E/Hn/nK8ZpIttpy03kk6jofgXEavrb j0f+ZVMhPtdtZv27FQ== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.87.95]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1Mm9Zi-1qsyLh4C6S-00iMiE; Sat, 30 Dec 2023 08:04:34 +0100 Message-ID: Date: Sat, 30 Dec 2023 08:04:32 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: scsi: ses: Move a label in ses_enclosure_data_process() Content-Language: en-GB To: James Bottomley , linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org, "Martin K. Petersen" Cc: LKML References: <4616e325-e313-4078-9788-dd1e6e51b9e0@web.de> <9d24844f30604f969ac10da456801f594ce72f2d.camel@linux.ibm.com> From: Markus Elfring In-Reply-To: <9d24844f30604f969ac10da456801f594ce72f2d.camel@linux.ibm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:ssePVKLr7X7YYW7M4vbgxXgx3i6L8c4Izh4MH9ObKOra4G/gfsA e44rrbzrGRS/L+C7MupMsG4jh40JTh7C7Yk+E9TuPMKOWiCmGQGkaxMBC+UFyP476QTP/NP RzWit4rhxBITKzGaFXLj8/s34JprLuTh0M9GwuBLPzusH8Yv3UGx5oV5mqg9MpF2+PwSgg2 XvrJqP3LMaTtswhxKotdw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:2lzua34+dEI=;+BaW9nVmUeud/3myjYL60Ga3r6X m44U5lz6s4yrB6gpa/29gx0gVDOKSOqFFOv76Ede9c1jRHK/7E4LIyywcPElm36HaVVDUwW9s 7viaT0n6tISZeOw7MIwh8WdRUk6vfUsRx586er2gVByBmg3xE8bDqxDejxS1t3NEXmcQ8TzlO 5l/l42JdtBrV0xF9hQuzzgojOXf2gsMeHyUiGb0e0Ngmp6Ha8LTnJDw8Jo0iZa7V+YNCstFVh kPEY9trR/+2BwRhQqi651NCifrScKgwU7n+rEAtTZyb+MXZER1n0zbYZKQFqmODEXs9nISLOE wbwRYlN1Y4Nl3CS7yM7V0c1CFxJwSNLmZtS4boVbsnfRopQvbSCPAlZ8qexsaPAP8vXy1wHEx NqnJqacSA7hOxB0+K6WfG1STIqKAy4ncTacCFKU7bEk3ZKdatLPC24W9sfSk5jRF1+7x/X9Py yR0zPzUo7DXq6Eiypj2c8XI5AB9SxY+I7q/zz58Q4P2oqcCnEUAIlzri16eX5A5Oi1gFh4W+B k4DQnvs1x7EzCfJgHvjpfLRpoeWZEj3/OuSoJvVTsa8Oq+M2AqJAUaRlWPm5/kTMIdrKQyH0U LVYuuVInC3BfcRU9iSMrGSP2b15Yh5KJsNTprR8NfqRCv5rOgUhzjzZVOqIgVuz7vV44joDGe ZrmjrYCg9/LtB1gWM5ZOR6cqYMRw/XkOoD+Oy4impAzsxVfy1IRMS0qRJtvbU5sJuZi+3bGlC Nlw4060n90jH9djd/aKdEWySPdFVbQn3mnVPRzUdXt1seUW5G+IrkejG1eifV6W17tnxnZFAP Vgj/70gUYWDeovsOJqfbKM6otmFV84pNailzlU6bPy1YCpOaL1spxaitTVkqeF2USXUZNirk6 cWXRLYbFNVjJMRdIA6wNdIU9yWkJ5pyIbli1YoOkJDE/HLGI2bFqQTqQfFTHB8JA7bOeegQYW 71CPDg== >> The kfree() function was called in up to three cases by >> the ses_enclosure_data_process() function during error handling >> even if the passed variable contained a null pointer. >> This issue was detected by using the Coccinelle software. > > Why is this an issue? The whole point of having kfree(NULL) be a nop Such =E2=80=9Ca nop=E2=80=9D can trigger the allocation of extra data proc= essing resources, can't it? > is so we don't have to special case the free path. A bit more development attention can hopefully connect the mentioned label with a more appropriate jump target directly. > The reason we do > that is because multiple special case paths through code leads to more > complex control flows and more potential bugs. You probably know some advices from another information source. https://wiki.sei.cmu.edu/confluence/display/c/MEM12-C.+Consider+using+a+go= to+chain+when+leaving+a+function+on+error+when+using+and+releasing+resourc= es > If coccinelle suddenly > thinks this is a problem, it's coccinelle that needs fixing. This software tool can help to point source code places out for further co= nsiderations. The search patterns are evolving accordingly. Regards, Markus