Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp310928ybn; Tue, 1 Oct 2019 21:32:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqxsq1CcKekqXiqsCRjv8aHp8WK4h1E3vPtOhDx/Kot9AWpOa46lvIHLmg938EQKIECOM4ll X-Received: by 2002:a17:906:b74e:: with SMTP id fx14mr1386274ejb.226.1569990767299; Tue, 01 Oct 2019 21:32:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569990767; cv=none; d=google.com; s=arc-20160816; b=m2iYDmJ68cO1/LbYyF9FbOfkPpME73zEXpKR7D874npIUsgzFU7hzglMPikKCfW14Z dHWWBtBy1c1RwznNSbA2VeI/rog1hj0sYA5r8m83jgkyWwJjhmiJcBkUuUmPqwjAPNyQ YEPyE/Qsrx47sByMpViyEDokccZ7Z+vEs6VW3LwyIZoWuhzrZBhuKXX4fVgm10ZEwlMJ wBqWlDCIHwPf1MoNdCKyI7kd69hA22R8JePcb15TNhf5+uSSPNxdsEeURhSkyDhIDkez GJhcbh0OZ8B7mKW9QklTZnUVZmirrKYqGR+/+/cYPPXUw+0Qabm9sTdrt4VK1zjZ63j1 vYuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject; bh=3v2O5fdxis/f7Rw74y45z+pEj/63xXbV5IQoDBoAs2I=; b=IVYWT+3Kcvh3Rl7EFij6PqSIuLM1bZspxoSjY4Zv0mmKQj9gdazvY5HzSt9LS9VGCo 13S5EG1VfSVp2cqyh9Jkn06GgJmRPCSEN8wQuTMuA9JaUw40aEDmdtaUyv7XJFAXNRDv aU91OgZICtYHepBLQPMfvOQnNOY+uHCHjgHiY/JhMcotGrivSDgnVse0+pDbL1UG+XWn vaU+G5DDam+0ftN2XprYB+wKV2yLDAPz8yoZnExml9Ik+amXIA9Slrj56bptQRU3lRuR wHMBew3cf2V6jDcQcO91zpUF//SNJeK1BWTb8pFkvK7DA4xWaOp8OJ1xf4Ip8dnlN3Wu ZPEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e25si10986127edb.308.2019.10.01.21.32.22; Tue, 01 Oct 2019 21:32:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727127AbfJAUPz (ORCPT + 99 others); Tue, 1 Oct 2019 16:15:55 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:42178 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725851AbfJAUPy (ORCPT ); Tue, 1 Oct 2019 16:15:54 -0400 Received: by mail-pf1-f194.google.com with SMTP id q12so8862415pff.9; Tue, 01 Oct 2019 13:15:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=3v2O5fdxis/f7Rw74y45z+pEj/63xXbV5IQoDBoAs2I=; b=Zrorv09IaQJ0d+4ofemtRGcxmvZlAy68p079P0YP3inbEn4BIYPOr7VmO/V9FnhlEx hegR4Ux8jkNqMNEsOz//ZH09GjvwHJQiDQZnkbsoTXuMo4586lpyRs3bEEC1vXlMRZvt KYk5RjL9+kDy35Si6fcKPArxse6PChRQ38ytQVcm6UwWx/wkCNQoPAF/bu2wXikdLSXl 9TK+Ubhznq6wOqTRSR4A+NOvGuBNBzOKzgkANhgaJflV8X04ITTTlQt7zgsDQbpneeSt Ydq1lho+JfA6mzGU/1tYR30i6lFqCmLYk/foVY29MYTx+jf/f9Oiy9eFLBk2wS03usby Lqmg== X-Gm-Message-State: APjAAAVBksdhATyom8H8Ld0S8b+vs1bWyQHkIB8Se5E40eAsdmEXuBDm OywPLUeOGzQ5fdcVGUmlGg8= X-Received: by 2002:a63:2447:: with SMTP id k68mr417221pgk.214.1569960952321; Tue, 01 Oct 2019 13:15:52 -0700 (PDT) Received: from [10.100.200.2] (li2036-46.members.linode.com. [172.105.75.46]) by smtp.gmail.com with ESMTPSA id b11sm17992109pgr.20.2019.10.01.13.15.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Oct 2019 13:15:51 -0700 (PDT) Subject: Re: [PATCH] staging: rtl8723bs: hal: Fix memcpy calls To: Dan Carpenter Cc: David Laight , "devel@driverdev.osuosl.org" , Jes Sorensen , Greg Kroah-Hartman , "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" , Hans de Goede , Bastien Nocera , Dmitry Vyukov , Larry Finger References: <20190930110141.29271-1-efremov@linux.com> <37b195b700394e95aa8329afc9f60431@AcuMS.aculab.com> <20191001135649.GH22609@kadam> <8d2e8196cae74ec4ae20e9c23e898207@AcuMS.aculab.com> <20191001185730.GM29696@kadam> From: Denis Efremov Autocrypt: addr=efremov@linux.com; keydata= mQINBFsJUXwBEADDnzbOGE/X5ZdHqpK/kNmR7AY39b/rR+2Wm/VbQHV+jpGk8ZL07iOWnVe1 ZInSp3Ze+scB4ZK+y48z0YDvKUU3L85Nb31UASB2bgWIV+8tmW4kV8a2PosqIc4wp4/Qa2A/ Ip6q+bWurxOOjyJkfzt51p6Th4FTUsuoxINKRMjHrs/0y5oEc7Wt/1qk2ljmnSocg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fCN8QEAjb0Rg+a 3fy1LiquAn003DyC92qphcGkCLN75YcaGlp33M/HrjrK1cttr7biJelb5FncRSUZqbbm0Ymj U4AKyfNrYaPz7vHJuijRNUZR2mntwiKotgLV95yL0dPyZxvOPPnbjF0cCtHfdKhXIt7Syzjb M8k2fmSF0FM+89/hP11aRrs6+qMHSd/s3N3j0hR2Uxsski8q6x+LxU1aHS0FFkSl0m8SiazA Gd1zy4pXC2HhCHstF24Nu5iVLPRwlxFS/+o3nB1ZWTwu8I6s2ZF5TAgBfEONV5MIYH3fOb5+ r/HYPye7puSmQ2LCXy7X5IIsnAoxSrcFYq9nGfHNcXhm5x6WjYC0Kz8l4lfwWo8PIpZ8x57v gTH1PI5R4WdRQijLxLCW/AaiuoEYuOLAoW481XtZb0GRRe+Tm9z/fCbkEveyPiDK7oZahBM7 QdWEEV8mqJoOZ3xxqMlJrxKM9SDF+auB4zWGz5jGzCDAx/0qMUrVn2+v8i4oEKW6IUdV7axW Nk9a+EF5JSTbfv0JBYeSHK3WRklSYLdsMRhaCKhSbwo8Xgn/m6a92fKd3NnObvRe76iIEMSw 60iagNE6AFFzuF/GvoIHb2oDUIX4z+/D0TBWH9ADNptmuE+LZnlPUAAEzRgUFtlN5LtJP8ph Message-ID: <6ea8c7b8-2b60-9baf-2374-3a3dac2d05b4@linux.com> Date: Tue, 1 Oct 2019 23:15:39 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <20191001185730.GM29696@kadam> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01.10.2019 21:58, Dan Carpenter wrote: > On Tue, Oct 01, 2019 at 06:13:21PM +0300, Denis Efremov wrote: >> Just found an official documentation to this issue: >> https://gcc.gnu.org/gcc-4.9/porting_to.html >> "Null pointer checks may be optimized away more aggressively >> ... >> The pointers passed to memmove (and similar functions in ) must be non-null >> even when nbytes==0, so GCC can use that information to remove the check after the >> memmove call. Calling copy(p, NULL, 0) can therefore deference a null pointer and crash." >> > > Correct. In glibc those functions are annotated as non-NULL. > > extern void *memcpy (void *__restrict __dest, const void *__restrict __src, > size_t __n) __THROW __nonnull ((1, 2)); > > We aren't going to do that in the kernel. A second difference is that > in the kernel we use -fno-delete-null-pointer-checks so it doesn't > delete the NULL checks. > Thank you for the clarification. This is really helpful. Best regards, Denis