[LU-7178] possible invalid memset in osd_acct_index_lookup Created: 17/Sep/15 Updated: 23/Sep/15 Resolved: 23/Sep/15 |
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Lustre 2.8.0 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Frank Zago (Inactive) | Assignee: | WC Triage |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | patch | ||
| Severity: | 3 |
| Rank (Obsolete): | 9223372036854775807 |
| Description |
|
The memset above look invalid. static int osd_acct_index_lookup(const struct lu_env *env, struct dt_object *dtobj, struct dt_rec *dtrec, const struct dt_key *dtkey) { struct osd_thread_info *info = osd_oti_get(env); #ifdef HAVE_DQUOT_FS_DISK_QUOTA struct fs_disk_quota *dqblk = &info->oti_fdq; #else struct if_dqblk *dqblk = &info->oti_dqblk; #endif struct super_block *sb = osd_sb(osd_obj2dev(osd_dt_obj(dtobj))); struct lquota_acct_rec *rec = (struct lquota_acct_rec *)dtrec; __u64 id = *((__u64 *)dtkey); int rc; #ifdef HAVE_DQUOT_KQID struct kqid qid; #endif ENTRY; memset((void *)dqblk, 0, sizeof(struct obd_dqblk)); Shouldn't that be ? memset(dqblk, 0, sizeof(*dqblk)); or am I missing some subtlety? If it's a bug it's also probably not seen by the static analyser because of the unneeded void * cast. |
| Comments |
| Comment by Frank Zago (Inactive) [ 18/Sep/15 ] |
| Comment by Gerrit Updater [ 22/Sep/15 ] |
|
Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/16482/ |
| Comment by Peter Jones [ 23/Sep/15 ] |
|
Landed for 2.8 |