Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2069268rwb; Mon, 7 Nov 2022 08:49:18 -0800 (PST) X-Google-Smtp-Source: AA0mqf6VstoMaYv3HTvtST79dWJZ+wwaiuDgZRfWWOtj6GJzyohodLWgKV+QQlPEKAw3JMqXB/4i X-Received: by 2002:a17:907:5014:b0:7ae:7475:85a8 with SMTP id fw20-20020a170907501400b007ae747585a8mr2418622ejc.617.1667839758107; Mon, 07 Nov 2022 08:49:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667839758; cv=none; d=google.com; s=arc-20160816; b=t9KlRV42+SVM0PPL7qI+oRC1kbY0Ks3tjpHIxb4dkRUCLUjKVR3JjABPnpy7inIr5Z gl/pFCbGUJnq7BJ8x0Skz6Hvvta5SJo2x9sqhYN5fF8J5zLhIb1aNr7SQJytdWXxcdcn EMO3ar5LcTbturcT2yTJTD7l92N2NKQTcSpMYYX84SzMdwVo4kJFVnL27RHxcZPynKPC qrE8BsD46gpiH3uVVxUirtsqC+sjuJXFo4dx6mWu9arcnLvJLF9ogc90ch5JRn8SKfQU WllgFHBNRl6sp+UFdu6cysYqfsNkNO7BnO00sVc8EVjT3sW2Cj1Ktrz7c6nDeA1opaBR 3lJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=VdVD9Iy0J2qFkVY2cKemTlbtgmWlhAb1cl0vbCf5xbI=; b=Dn9qPHM/yNOMZZ5scqoqIB5ng+rbnZ9Monub/+k/rofcVNuz+45QCv5V/PHUuIy3oD 1ra8cB8u0U/VkceFL7sIO3Nn4dYZBjtsHpltHCDXbBt3g8BbblFWL4DpNKvWpQfHMT2s Pkzc+aaOiewz6iccI8FYGeJYK28OfOwb7bbIG/2m2scwHIblW9DPYNdFUU03LeW2Mloc ZuL2nxmLPG/lLDR83UMnj3CEMJpZFbM/q+/+bKl0UOSsVAlqcZUN8BbeTeDEBa3GLaTy wsUvDbQ1lNr/TbOrKpLMcCiheakjk69KiQQbKi1ohqSrMYVvGAhcNPKVFFjfbvdYIyAp jtVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=vBUVPW0o; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hb18-20020a170907161200b007ae72eabbe0si1987617ejc.928.2022.11.07.08.48.54; Mon, 07 Nov 2022 08:49:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=vBUVPW0o; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232390AbiKGQ1k (ORCPT + 92 others); Mon, 7 Nov 2022 11:27:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233015AbiKGQ1G (ORCPT ); Mon, 7 Nov 2022 11:27:06 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3E4D20F51 for ; Mon, 7 Nov 2022 08:23:41 -0800 (PST) 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 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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