All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wu XiangCheng <wu.xiangcheng@linux.dev>
To: Yanteng Si <siyanteng@loongson.cn>
Cc: alexs@kernel.org, seakeel@gmail.com, corbet@lwn.net,
	chenhuacai@kernel.org, linux-doc@vger.kernel.org,
	siyanteng01@gmail.com
Subject: Re: [PATCH v1 07/13] docs/zh_CN: Update the translation of testing-overview to 6.1-rc8
Date: Fri, 9 Dec 2022 15:05:18 +0800	[thread overview]
Message-ID: <Y5LeLgzv4O6cn83+@bobwxc.mipc> (raw)
In-Reply-To: <8a99b6f6ac2bbc834aad551b464a3d4a27d82630.1670502763.git.siyanteng@loongson.cn>

> Update to commit a32d5c0fc12b ("Documentation: dev-tools:
> Enhance static analysis section with discussion")
> 
> Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
> ---
>  .../zh_CN/dev-tools/testing-overview.rst      | 27 +++++++++++++++++++
>  1 file changed, 27 insertions(+)
> 
> diff --git a/Documentation/translations/zh_CN/dev-tools/testing-overview.rst b/Documentation/translations/zh_CN/dev-tools/testing-overview.rst
> index d6f2c65ed511..d53a326de93a 100644
> --- a/Documentation/translations/zh_CN/dev-tools/testing-overview.rst
> +++ b/Documentation/translations/zh_CN/dev-tools/testing-overview.rst
> @@ -132,3 +132,30 @@ Documentation/dev-tools/kcov.rst 是能够构建在内核之中,用于在每
>  
>   不过要注意的是,静态分析工具存在**假阳性**的问题。在试图修复错误和警
>   告之前,需要仔细评估它们。
> +
> +何时使用Sparse和Smatch
> +----------------------
> +
> +Sparse做类型检查,例如验证注释的变量不会导致无符号的错误,检测
> +``__user`` 指针使用不当的地方,以及分析符号初始化器的兼容性。
> +
> +Smatch进行流程分析,如果允许建立函数数据库,它还会进行跨函数分析。
> +Smatch试图回答一些问题,比如这个缓冲区是在哪里分配的?它有多大?这
> +个索引可以由用户控制吗?这个变量比那个变量大吗?
> +
> +一般来说,在Smatch中写检查比在Sparse中写检查要容易。尽管如此,
> +Sparse和Smatch的检查还是有一些重叠的地方。
> +
> +Smatch和Coccinelle的强项
> +------------------------
> +
> +Coccinelle可能是最容易写检查的。它在预处理器之前工作,所以用Coccinelle
> +检查宏中的错误更容易。Coccinelle还能为你创建补丁,这是其他工具无法做到的。
> +
> +例如,用Coccinelle你可以从kmalloc(x * size, GFP_KERNEL)到

``kmalloc(x * size, GFP_KERNEL)``

> +``kmalloc_array(x, size, GFP_KERNEL)`` 进行大规模转换,这真的很有用。
> +如果你只是创建一个Smatch警告,并试图把转换的工作推给维护者,他们会很恼火。
> +你将不得不为每个警告争论是否真的可以溢出。
> +
> +Coccinelle不对变量值进行分析,而这正是Smatch的强项。另一方面,Coccinelle
> +允许你用简单的方法做简单的事情。
> -- 
> 2.31.1
> 

  reply	other threads:[~2022-12-09  7:05 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-08 12:57 [PATCH v1 00/13] docs/zh_CN: Update the translation to 6.1-rc8 Yanteng Si
2022-12-08 12:57 ` [PATCH v1 01/13] docs/zh_CN: Update the translation of delay-accounting " Yanteng Si
2022-12-09  6:55   ` Wu XiangCheng
2022-12-10  2:51     ` Yanteng Si
2022-12-08 12:57 ` [PATCH v1 02/13] docs/zh_CN: Update the translation of kernel-api " Yanteng Si
2022-12-09  6:57   ` Wu XiangCheng
2022-12-08 12:57 ` [PATCH v1 03/13] docs/zh_CN: Update the translation of mm-api " Yanteng Si
2022-12-09  7:01   ` Wu XiangCheng
2022-12-08 12:57 ` [PATCH v1 04/13] docs/zh_CN: Update the translation of highmem " Yanteng Si
2022-12-09  7:02   ` Wu XiangCheng
2022-12-08 12:57 ` [PATCH v1 05/13] docs/zh_CN: Update the translation of page_owner " Yanteng Si
2022-12-09  7:03   ` Wu XiangCheng
2022-12-08 12:57 ` [PATCH v1 06/13] docs/zh_CN: Update the translation of kasan " Yanteng Si
2022-12-09  7:33   ` Wu XiangCheng
2022-12-10  3:11     ` Yanteng Si
2022-12-08 12:58 ` [PATCH v1 07/13] docs/zh_CN: Update the translation of testing-overview " Yanteng Si
2022-12-09  7:05   ` Wu XiangCheng [this message]
2022-12-10  2:56     ` Yanteng Si
2022-12-08 12:59 ` [PATCH v1 08/13] docs/zh_CN: Update the translation of reclaim " Yanteng Si
2022-12-09  7:06   ` Wu XiangCheng
2022-12-08 12:59 ` [PATCH v1 09/13] docs/zh_CN: Update the translation of start " Yanteng Si
2022-12-09  7:07   ` Wu XiangCheng
2022-12-08 12:59 ` [PATCH v1 10/13] docs/zh_CN: Update the translation of usage " Yanteng Si
2022-12-09  7:08   ` Wu XiangCheng
2022-12-08 12:59 ` [PATCH v1 11/13] docs/zh_CN: Update the translation of ksm " Yanteng Si
2022-12-09  7:09   ` Wu XiangCheng
2022-12-10  3:04     ` Yanteng Si
2022-12-08 12:59 ` [PATCH v1 12/13] docs/zh_CN: Update the translation of msi-howto " Yanteng Si
2022-12-09  7:10   ` Wu XiangCheng
2022-12-08 12:59 ` [PATCH v1 13/13] docs/zh_CN: Update the translation of energy-model " Yanteng Si
2022-12-09  7:12   ` Wu XiangCheng
2022-12-10  3:06     ` Yanteng Si

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y5LeLgzv4O6cn83+@bobwxc.mipc \
    --to=wu.xiangcheng@linux.dev \
    --cc=alexs@kernel.org \
    --cc=chenhuacai@kernel.org \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=seakeel@gmail.com \
    --cc=siyanteng01@gmail.com \
    --cc=siyanteng@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.