Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
29c353b3
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
29c353b3
编写于
6月 24, 2014
作者:
J
J. Bruce Fields
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
nfsd4: define svcxdr_dupstr to share some common code
Signed-off-by:
N
J. Bruce Fields
<
bfields@redhat.com
>
上级
ce043ac8
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
23 addition
and
13 deletion
+23
-13
fs/nfsd/nfs4xdr.c
fs/nfsd/nfs4xdr.c
+23
-13
未找到文件。
fs/nfsd/nfs4xdr.c
浏览文件 @
29c353b3
...
...
@@ -202,6 +202,26 @@ defer_free(struct nfsd4_compoundargs *argp, void *p)
return
0
;
}
/*
* For xdr strings that need to be passed to other kernel api's
* as null-terminated strings.
*
* Note null-terminating in place usually isn't safe since the
* buffer might end on a page boundary.
*/
static
char
*
svcxdr_dupstr
(
struct
nfsd4_compoundargs
*
argp
,
void
*
buf
,
u32
len
)
{
char
*
p
=
kmalloc
(
len
+
1
,
GFP_KERNEL
);
if
(
!
p
)
return
NULL
;
memcpy
(
p
,
buf
,
len
);
p
[
len
]
=
'\0'
;
defer_free
(
argp
,
p
);
return
p
;
}
/**
* savemem - duplicate a chunk of memory for later processing
* @argp: NFSv4 compound argument structure to be freed with
...
...
@@ -415,12 +435,10 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval,
return
nfserr_badlabel
;
len
+=
(
XDR_QUADLEN
(
dummy32
)
<<
2
);
READMEM
(
buf
,
dummy32
);
label
->
data
=
kzalloc
(
dummy32
+
1
,
GFP_KERNEL
);
label
->
len
=
dummy32
;
label
->
data
=
svcxdr_dupstr
(
argp
,
buf
,
dummy32
);
if
(
!
label
->
data
)
return
nfserr_jukebox
;
label
->
len
=
dummy32
;
defer_free
(
argp
,
label
->
data
);
memcpy
(
label
->
data
,
buf
,
dummy32
);
}
#endif
...
...
@@ -597,17 +615,9 @@ nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create
READ_BUF
(
4
);
create
->
cr_datalen
=
be32_to_cpup
(
p
++
);
READ_BUF
(
create
->
cr_datalen
);
/*
* The VFS will want a null-terminated string, and
* null-terminating in place isn't safe since this might
* end on a page boundary:
*/
create
->
cr_data
=
kmalloc
(
create
->
cr_datalen
+
1
,
GFP_KERNEL
);
create
->
cr_data
=
svcxdr_dupstr
(
argp
,
p
,
create
->
cr_datalen
);
if
(
!
create
->
cr_data
)
return
nfserr_jukebox
;
memcpy
(
create
->
cr_data
,
p
,
create
->
cr_datalen
);
create
->
cr_data
[
create
->
cr_datalen
]
=
'\0'
;
defer_free
(
argp
,
create
->
cr_data
);
break
;
case
NF4BLK
:
case
NF4CHR
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录