Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932554AbbDHTZR (ORCPT ); Wed, 8 Apr 2015 15:25:17 -0400 Received: from mailrelay116.isp.belgacom.be ([195.238.20.143]:35841 "EHLO mailrelay116.isp.belgacom.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932219AbbDHTYT (ORCPT ); Wed, 8 Apr 2015 15:24:19 -0400 X-Belgacom-Dynamic: yes X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=Ax9Kd9og7W2htzcJF9odWb+87PP6pPoG1t8Q07ebhfo= c=1 sm=2 a=RftdDdqNeMo54lKss6IA:9 a=0bXxn9q0MV6snEgNplNhOjQmxlI=:19 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2BwCACEfyVV/8wuQFdcgwiBLrISAQEBAQEBBQF7kFyHTwKBKzoTAQEBAQEBAX2EIAEBBCcvIxBROR4ZiC4BzREBAQgihhCKFwcWhBcFmnuLUYkKIoIzgT48MYJDAQEB From: Fabian Frederick To: linux-kernel@vger.kernel.org Cc: Jan Kara , Fabian Frederick Subject: [PATCH V2 7/9 linux-next] udf: return error when newIndex is 0 in udf_translate_to_linux() Date: Wed, 8 Apr 2015 21:23:57 +0200 Message-Id: <1428521039-18491-8-git-send-email-fabf@skynet.be> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1428521039-18491-1-git-send-email-fabf@skynet.be> References: <1428521039-18491-1-git-send-email-fabf@skynet.be> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1946 Lines: 67 udf_get_filename() and its callsites considered 0 as an error without propagating an error value. udf_translate_to_linux() now returns -EINVAL when newIndex is 0. other functions are updated accordingly. Signed-off-by: Fabian Frederick --- fs/udf/dir.c | 2 +- fs/udf/namei.c | 2 +- fs/udf/unicode.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/udf/dir.c b/fs/udf/dir.c index fcf227e..541d9c6 100644 --- a/fs/udf/dir.c +++ b/fs/udf/dir.c @@ -168,7 +168,7 @@ static int udf_readdir(struct file *file, struct dir_context *ctx) } flen = udf_get_filename(sb, nameptr, lfi, fname, UDF_NAME_LEN); - if (flen <= 0) + if (flen < 0) continue; tloc = lelb_to_cpu(cfi.icb.extLocation); diff --git a/fs/udf/namei.c b/fs/udf/namei.c index 59b340c..dd648b7 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c @@ -234,7 +234,7 @@ static struct fileIdentDesc *udf_find_entry(struct inode *dir, continue; flen = udf_get_filename(sb, nameptr, lfi, fname, UDF_NAME_LEN); - if ((flen > 0) && udf_match(flen, fname, child->len, + if ((flen >= 0) && udf_match(flen, fname, child->len, child->name)) goto out_ok; } diff --git a/fs/udf/unicode.c b/fs/udf/unicode.c index f37123b..3b1efbb 100644 --- a/fs/udf/unicode.c +++ b/fs/udf/unicode.c @@ -333,7 +333,7 @@ int udf_get_filename(struct super_block *sb, uint8_t *sname, int slen, uint8_t *dname, int dlen) { struct ustr *filename, *unifilename; - int ret = 0; + int ret; if (!slen) return -EIO; @@ -492,5 +492,5 @@ static int udf_translate_to_linux(uint8_t *newName, int newLen, } } - return newIndex; + return newIndex ? : -EINVAL; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/