From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932358AbbHNCwz (ORCPT ); Thu, 13 Aug 2015 22:52:55 -0400 Received: from mail-yk0-f170.google.com ([209.85.160.170]:33176 "EHLO mail-yk0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751993AbbHNCwy (ORCPT ); Thu, 13 Aug 2015 22:52:54 -0400 From: Fabio Estevam To: akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, Fabio Estevam Subject: [PATCH] lib/decompress_unlzma: Do a NULL check for pointer Date: Thu, 13 Aug 2015 23:52:30 -0300 Message-Id: <1439520750-17032-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Fabio Estevam Compare pointer-typed values to NULL rather than 0. The semantic patch that makes this change is available in scripts/coccinelle/null/badzero.cocci. Signed-off-by: Fabio Estevam --- lib/decompress_unlzma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/decompress_unlzma.c b/lib/decompress_unlzma.c index 0be83af..04d6813 100644 --- a/lib/decompress_unlzma.c +++ b/lib/decompress_unlzma.c @@ -620,7 +620,7 @@ STATIC inline int INIT unlzma(unsigned char *buf, long in_len, num_probs = LZMA_BASE_SIZE + (LZMA_LIT_SIZE << (lc + lp)); p = (uint16_t *) large_malloc(num_probs * sizeof(*p)); - if (p == 0) + if (p == NULL) goto exit_2; num_probs = LZMA_LITERAL + (LZMA_LIT_SIZE << (lc + lp)); for (i = 0; i < num_probs; i++) -- 1.9.1