From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBE3EC4321E for ; Mon, 7 Nov 2022 16:23:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5CC668E0005; Mon, 7 Nov 2022 11:23:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 554F78E0002; Mon, 7 Nov 2022 11:23:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 41CFE8E0005; Mon, 7 Nov 2022 11:23:43 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 2BEED8E0002 for ; Mon, 7 Nov 2022 11:23:43 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id E44461A0358 for ; Mon, 7 Nov 2022 16:23:42 +0000 (UTC) X-FDA: 80107167084.15.69646B4 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf18.hostedemail.com (Postfix) with ESMTP id 1B3F01C000A for ; Mon, 7 Nov 2022 16:23:41 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 8D1511F889; Mon, 7 Nov 2022 16:23:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1667838220; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VdVD9Iy0J2qFkVY2cKemTlbtgmWlhAb1cl0vbCf5xbI=; b=vBUVPW0o/dbrqtz3mD/bXG7oo6YeijAN4TfU7xNCshIE4vb3PPu8hZczD4I3vtd5i7da8X V/MOmSToQIx36MlFVgWhlmcqD9zSCGDCrqN+cmOFEbl+GVaF4Nac9WNHolAHYrlLsnq0FW I2+wck7CmtdTpc/HxJ6U7rNEEoN8gJI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1667838220; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VdVD9Iy0J2qFkVY2cKemTlbtgmWlhAb1cl0vbCf5xbI=; b=n92vtlvGc69ogFNhO2Gpbw4jMAXPuHVc2k8fAnvoasp1beVEu/t59Ut6ly5HDIvHmM8EO4 enKwkl9y6dIDPYBA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5BEE213AC7; Mon, 7 Nov 2022 16:23:40 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id zbAlFQwxaWM+WQAAMHmgww (envelope-from ); Mon, 07 Nov 2022 16:23:40 +0000 Message-ID: <71b57f2d-37cd-9c33-c6b2-7f4b14b2b691@suse.cz> Date: Mon, 7 Nov 2022 17:23:40 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Subject: Re: Duplicate kernel-doc comments for ksize() Content-Language: en-US To: Akira Yokosawa , Kees Cook , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Christoph Lameter , David Rientjes , Joonsoo Kim , Pekka Enberg , Roman Gushchin Cc: Jonathan Corbet , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: From: Vlastimil Babka In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667838222; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=VdVD9Iy0J2qFkVY2cKemTlbtgmWlhAb1cl0vbCf5xbI=; b=VA39nRk+nYZ3PpuExNKO9YCF9E1lj2cLIm7G8+2MRBD1GjG3iOmgd9PpegKKHZx+DTG7OU YY0WAhXkIWz3NVHLKeJfeO5qT3bQ0hR36hzH3EyWuAXvDjQ4GdVoyek+EhuBLKk+SF1reQ ndEiySlxi/v3805FEcegxUAndiqB0As= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=vBUVPW0o; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=n92vtlvG; spf=pass (imf18.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667838222; a=rsa-sha256; cv=none; b=C+rWrPa4A8KVEprmtjvavuOu/Ol/t/6JwQh/5/cUtCOBUz+o0+PdpzhDlefm0StwZ9RMHw XS5A5JcKrTFWunRYBygWKwt14WXMaHJr7G65m4mC14d7om4kh02leQLSIpIU9ipux1ICFg g4mADMyu0Wpgv+VOa1CML+IXE05m1lk= Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=vBUVPW0o; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=n92vtlvG; spf=pass (imf18.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 1B3F01C000A X-Stat-Signature: hwpuiek41r5k9j55ix3ec3m8e4e7anm4 X-HE-Tag: 1667838221-619435 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 11/7/22 11:41, Akira Yokosawa wrote: > Hi Kees, > > "make htmldocs" reports duplicate C declaration of ksize() > as follows: > > /linux/Documentation/core-api/mm-api:43: ./mm/slab_common.c:1428: WARNING: Duplicate C declaration, also defined at core-api/mm-api:212. > Declaration is '.. c:function:: size_t ksize (const void *objp)'. > > This is due to the kernel-doc comment for ksize() added in > include/linux/slab.h by a commit you have authored: > 05a940656e1e ("slab:Introduce kmalloc_size_roundup()"). > > /** > * ksize - Report actual allocation size of associated object > * > * @objp: Pointer returned from a prior kmalloc()-family allocation. > * > * This should not be used for writing beyond the originally requested > * allocation size. Either use krealloc() or round up the allocation size > * with kmalloc_size_roundup() prior to allocation. If this is used to > * access beyond the originally requested allocation size, UBSAN_BOUNDS > * and/or FORTIFY_SOURCE may trip, since they only know about the > * originally allocated size via the __alloc_size attribute. > */ > > There is another kernel-doc comment in mm/slab_common.c (originally > by Manfred, since v2.6.14): > > /** > * ksize - get the actual amount of memory allocated for a given object > * @objp: Pointer to the object > * > * kmalloc may internally round up allocations and return more memory > * than requested. ksize() can be used to determine the actual amount of > * memory allocated. The caller may use this additional memory, even though > * a smaller amount of memory was initially specified with the kmalloc call. > * The caller must guarantee that objp points to a valid object previously > * allocated with either kmalloc() or kmem_cache_alloc(). The object > * must not be freed during the duration of the call. > * > * Return: size of the actual memory used by @objp in bytes > */ > > I guess the one in slab_common.c is outdated and can be removed. > Can you please take care of it? Thanks for the report, I've removed the comment myself in a slab.git fixes branch I'll be sending a PR for this week: https://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab.git/commit/?h=slab/for-6.1-rc4/fixes&id=c18c20f16219516b12a4f2fd29c25e06be97e064 > Thanks, Akira