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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61EDAC433EF for ; Fri, 25 Mar 2022 21:25:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233389AbiCYV1S (ORCPT ); Fri, 25 Mar 2022 17:27:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233390AbiCYV1Q (ORCPT ); Fri, 25 Mar 2022 17:27:16 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA80B23C0EC for ; Fri, 25 Mar 2022 14:25:41 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id B6D2E1F467F3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1648243540; bh=HXeqRMeQE7R6n2ndddhQlyV94EIUHcEA4j5aKNJbKiA=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=cgNbsUIx6OwXBs3omsY+8iI3cXeFj+zeqJTXDTFwHW0tnjbtszuac7SMLYrWaKxCW ih3/uhsZHWLADspwx7Xc+Lf7LgAwje2BR53RIu+Y6OEmzIx9VD3juJcLzUOzCHa9Th xNzFoHdrBl3cL37xgSWlIFt+6BNntMXwm2oyXyYHAji4kDKC+WfWbwYhg5Jdi9CtSh CXhjvu+rRtXa4hp+F9PgV7c0yLZBgaHlwynFagIHJz3UDZZj9Cpg6o+00PtnDpWwVq nKUWkrM/74z0swALxf0xlsG/U2A84ZwC9UxfmGl+rTXH9nafIIXoVXyXKqBeqLcom4 clmdyI72L99tQ== From: Gabriel Krisman Bertazi To: jianchunfu Cc: linux-fsdevel@vger.kernel.org Subject: Re: [RFC] fs:unicode:mkutf8data.c: Fix the potential stack overflow risk Organization: Collabora References: <20220325091443.59677-1-jianchunfu@cmss.chinamobile.com> Date: Fri, 25 Mar 2022 17:25:35 -0400 In-Reply-To: <20220325091443.59677-1-jianchunfu@cmss.chinamobile.com> (jianchunfu@cmss.chinamobile.com's message of "Fri, 25 Mar 2022 17:14:43 +0800") Message-ID: <87o81tpvw0.fsf@collabora.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org jianchunfu writes: > I'm not sure why there are so many missing checks of the malloc function, > is it because the memory allocated is only a few bytes > so no checks are needed? > > Signed-off-by: jianchunfu Hi jianchunfu, Thanks for the patch. Beyond what Eric said, the patch prefix should be just "unicode:". When in doubt you can see the previous patches to the subsystem in the git log. Also, I think these are not really stack overflows, but a bad memory access if malloc fails. What do you think of something like unicode: Handle memory allocation failures in mkutf8data or something like that. Thanks, -- Gabriel Krisman Bertazi