diff options
author | Sumit Semwal <sumit.semwal@linaro.org> | 2015-02-20 22:30:17 -0500 |
---|---|---|
committer | Sumit Semwal <sumit.semwal@linaro.org> | 2015-04-21 05:17:16 -0400 |
commit | 72449cb47b0104c32ff8fb9380ade9113375d8d1 (patch) | |
tree | f3cf60315d9b4a994e62c86ac4c9db44daaa85a0 | |
parent | d8fbe341beb617ebb22b98fb893e4aa32ae2d864 (diff) |
staging: android: ion: fix wrong init of dma_buf_export_info
Fixes: 817bd7253291 ("dma-buf: cleanup dma_buf_export() to make it
easily extensible")
Stupid copy-paste from me in the above patch leads to the following static
checker warning:
drivers/staging/android/ion/ion.c:1112 ion_share_dma_buf()
error: potentially dereferencing uninitialized 'buffer'.
drivers/staging/android/ion/ion.c
1103 struct dma_buf *ion_share_dma_buf(struct ion_client *client,
1104 struct
ion_handle *handle)
1105 {
1106 struct ion_buffer *buffer;
^^^^^^
1107 struct dma_buf *dmabuf;
1108 bool valid_handle;
1109 DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
1110
1111 exp_info.ops = &dma_buf_ops;
1112 exp_info.size = buffer->size;
^^^^^^
1113 exp_info.flags = O_RDWR;
1114 exp_info.priv = buffer;
^^^^^^
And here also.
1115
This patch corrects this stupidity.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
-rw-r--r-- | drivers/staging/android/ion/ion.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index b94d69feff46..b0b96ab31954 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c | |||
@@ -1108,11 +1108,6 @@ struct dma_buf *ion_share_dma_buf(struct ion_client *client, | |||
1108 | bool valid_handle; | 1108 | bool valid_handle; |
1109 | DEFINE_DMA_BUF_EXPORT_INFO(exp_info); | 1109 | DEFINE_DMA_BUF_EXPORT_INFO(exp_info); |
1110 | 1110 | ||
1111 | exp_info.ops = &dma_buf_ops; | ||
1112 | exp_info.size = buffer->size; | ||
1113 | exp_info.flags = O_RDWR; | ||
1114 | exp_info.priv = buffer; | ||
1115 | |||
1116 | mutex_lock(&client->lock); | 1111 | mutex_lock(&client->lock); |
1117 | valid_handle = ion_handle_validate(client, handle); | 1112 | valid_handle = ion_handle_validate(client, handle); |
1118 | if (!valid_handle) { | 1113 | if (!valid_handle) { |
@@ -1124,6 +1119,11 @@ struct dma_buf *ion_share_dma_buf(struct ion_client *client, | |||
1124 | ion_buffer_get(buffer); | 1119 | ion_buffer_get(buffer); |
1125 | mutex_unlock(&client->lock); | 1120 | mutex_unlock(&client->lock); |
1126 | 1121 | ||
1122 | exp_info.ops = &dma_buf_ops; | ||
1123 | exp_info.size = buffer->size; | ||
1124 | exp_info.flags = O_RDWR; | ||
1125 | exp_info.priv = buffer; | ||
1126 | |||
1127 | dmabuf = dma_buf_export(&exp_info); | 1127 | dmabuf = dma_buf_export(&exp_info); |
1128 | if (IS_ERR(dmabuf)) { | 1128 | if (IS_ERR(dmabuf)) { |
1129 | ion_buffer_put(buffer); | 1129 | ion_buffer_put(buffer); |