From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759756AbcIMSZJ (ORCPT ); Tue, 13 Sep 2016 14:25:09 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:38286 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755470AbcIMSZH (ORCPT ); Tue, 13 Sep 2016 14:25:07 -0400 X-IBM-Helo: d06dlp01.portsmouth.uk.ibm.com X-IBM-MailFrom: borntraeger@de.ibm.com X-IBM-RcptTo: kernel-janitors@vger.kernel.org;linux-kernel@vger.kernel.org Subject: Re: virtio_blk: Less function calls in init_vq() after error detection To: SF Markus Elfring , virtualization@lists.linux-foundation.org, "Michael S. Tsirkin" , Minfei Huang , Cornelia Huck , Stefan Hajnoczi References: <566ABCD9.1060404@users.sourceforge.net> <02054675-8395-ac81-6863-e3a5cbfc9032@users.sourceforge.net> <7da823eb-939c-9ee6-32bf-db296e6a96f6@users.sourceforge.net> Cc: Julia Lawall , kernel-janitors@vger.kernel.org, LKML , Chao Fan From: Christian Borntraeger Date: Tue, 13 Sep 2016 20:24:58 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <7da823eb-939c-9ee6-32bf-db296e6a96f6@users.sourceforge.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16091318-0040-0000-0000-000002260F50 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16091318-0041-0000-0000-000021B693B7 Message-Id: <44fd46f6-441a-d497-9157-7e2a0f3f45da@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-09-13_09:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609020000 definitions=main-1609130261 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/13/2016 07:30 PM, SF Markus Elfring wrote: [...] > Unfortunately, I get an other impression here after a closer look. > > Can it be that the discussed commit from 2016-08-09 accepted (or tolerated) > two weaknesses at least? > > 1. Commit title: > Is the word "slient" a typo? > Would you like to read "silent" there instead? > > 2. Source code: > Why would another memory allocation be attempted if it could be determined quicker > that a previous one failed and this function implementation can not succeed then? > > How much will it matter in general that two function calls are performed > in this use case without checking their return values immediately? > https://cwe.mitre.org/data/definitions/252.html > > if (!names || !callbacks || !vqs) { … > > https://cwe.mitre.org/data/definitions/754.html > The return values are checked, just a bit later. Markus, kernel patches are not about be formally correct vs. CodingStyle and/or checkpatch or against code guidelines from sombody else. You will find many people consider gotos an no-go, still it is accepted in the kernel for good reasons. You have to think about each change and its tradeoffs (e.g simplicity vs. performance) for each code part again. Here we have slow path error handling, so given the low coverage of these code parts, simplicity is important. Yes, your code makes an unlikely error case bail out faster, but is the cost of your patch (review time, danger of adding bugs, danger of merge conflicts, making git blame less useful) in sync with the expected win? This is certainly Michaels area of maintainership and if he wants your patch, it will be fine too. (Well, having a label between the if and the function like > if (err) > + free_vblk_vqs: > kfree(vblk->vqs); is certainly ugly in itself) > Was the software development attention a bit too low as it happens occasionally? > > > I hope that my suggestions can improve the affected situation a bit more > also for this software module. Do you realize that your discussion style is not very helpful? I just grepped the last LKML mails and you already pissed of several maintainers in totally different areas. When that happens, why don't you stop for a moment and think about "what is going wrong right now". Your attitude seems to be "I spend my spare time doing this, please thank me for that". The thing is, with each patch you actually request time from the maintainer. Now here begins the interesting part: Is the patch just a cosmetic change that does not give you any benefit or is the patch improving the code. And remember: there are always tradeoffs: performance, code size, code maintainability etc. See, some of your patches are accepted, e.g. the memdup_user changes have usually been applied by most maintainers including myself. If maintainers won't take other change, please accept that. If you continue to waste peoples time by discussing "maybe" patches you actually risk that people will stop taking any patches from you including the "yes" ones. Christian